叶子个数
int num(struct BiTNode *t){ if (t != NULL) { if (t -> lchild == NULL && t -> rchild == NULL) count ++; else { num(t -> lchild); num(t -> rchild); } } return count;}
二叉树的深度
int depth(struct BiTNode *t) { int d1, d2; if (t != NULL) { d1 = depth(t -> lchild); d2 = depth(t -> rchild); if (d1 > d2) return d1 + 1; else return d2 + 1; } }
新闻热点
疑难解答