int bt_height(btree tree) {
int leftdep, rightdep;
if (tree == NULL) {
return 0;
} else {
leftdep = bt_height(tree->lchild);
rightdep = bt_height(tree->rchild);
return (leftdep >= rightdep ? (leftdep + 1) : (rightdep + 1));
}
}
int leftdep, rightdep;
if (tree == NULL) {
return 0;
} else {
leftdep = bt_height(tree->lchild);
rightdep = bt_height(tree->rchild);
return (leftdep >= rightdep ? (leftdep + 1) : (rightdep + 1));
}
}
转载于:https://blog.51cto.com/wujuxiang/421973