求二叉树的高度: int binary_height(tree bt){ int hl,hr,maxh; if (bt){ hl=binary_height(bt->left); //左子树深度 hr=binary_height(bt->right); //右子树深度 maxh=(hl>hr)?hl:hr; //取左右子树最大深度 return (maxh+1); //树高为左右子树最大深度+1 } else return 0; //空树深度为0 }