• 2021-04-14
    假设二叉树采用链式方式存储,t为其根结点,请选择正确的选项将函数int Depth(bintree t) 补充完整,该函数功能为求树t的高度。二叉链表定义如下:typedef struct node{datatype data;struct node *lchild,*rchild;}bintnodetypedef bintnode *bintree;函数定义如下:int depth(bintree t) {int height,leftTreeHeight,rightTreeHeight; if (t==NULL) (1) ; else { (2) ; rightTreeHeight =depth(t->rchild); if ( (3) ) height=leftTreeHeight+1; else height= rightTreeHeight +1; } return height;}
  • 举一反三