只给出函数
void countleaf(struct node *root)//统计叶子数; { if(root) { if((!root->lchild)&&(!root->rchild)) { count++; } countleaf(root->lchild); countleaf(root->rchild); } }
int max(int a, int b)//比较大小 { if(a>b) return a; else return b; } int hight(struct node *root)//从根到子结点最深的一条长度(根节点的深度为1) { if(root==NULL) return 0; else return max(hight(root->lchild), hight(root->rchild))+1; }