int Deapth(Tree * root){//二叉树的深度 if(!root){ return 0; } int m=Deapth(root->Left); int n=Deapth(root->Right); return m>n?m+1:n+1; } int LeaveNum(Tree * root){//二叉树的叶子数 if(!root){ return 0; } if(!root->Left&&!root->Right){ return 1; } else return LeaveNum(root->Left)+LeaveNum(root->Right); }
二叉树的深度和叶子节点数
猜你喜欢
转载自blog.csdn.net/m0_37848958/article/details/78795145
今日推荐
周排行