您的位置:首页 > 其它

二叉树深度高度统计递归

2011-08-28 11:31 246 查看
static 注意就行了..

int max(int a,int b)

{

return a>b?a:b;

}

int countdepth(BinaryTreeNode * ptr)

{
static int x=0;
if(ptr==0)
return 0;
return 1+max(countdepth(ptr->left),countdepth(ptr->right));

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐