《数据结构和算法创新设计》树习题.pptVIP

  • 1
  • 0
  • 约1.05万字
  • 约 37页
  • 2019-11-28 发布于广东
  • 举报

《数据结构和算法创新设计》树习题.ppt

* 2005 a. int BiTreeDepth(BiTree T) { int ldepth, rdepth; if ( !T ) return -1; ldepth = BiTreeDepth ( T-lchild ) ; rdepth = BiTreeDepth ( T-rchild ) ; if ( ldepth = rdepth ) T-depth = ldepth+1; else T-depth = rdepth+1; return T-depth; } ? ? ? b. Status BiTreeBalance(BiTree T) { int ldepth, rdepth; if ( T==NULL ) return TRUE; if (T-lchild) ldepth = T-lchild-depth; else ldepth = -1; if (T-rchild) rdepth = T-rchild-depth; else rdepth = -1; lrdepth = ldepth – rdepth; if ( ( lrdepth == 0 || lrdepth == 1 |

文档评论(0)

1亿VIP精品文档

相关文档