如何求一个二叉树的深度?
程序代码:int j=0;//能不能用j获得一个二叉树的深度
Status BiTreeDepth(BiTree T,int i)//用的链式存储结构
{
if(T==NULL)
{
return OK;
}
if(j<i)
j=i;
BiTreeDepth(T->lchild,i+1);
BiTreeDepth(T->rchild,i+1);
}
程序代码:int j=0;//能不能用j获得一个二叉树的深度
Status BiTreeDepth(BiTree T,int i)//用的链式存储结构
{
if(T==NULL)
{
return OK;
}
if(j<i)
j=i;
BiTreeDepth(T->lchild,i+1);
BiTreeDepth(T->rchild,i+1);
}
2013-05-26 16:49

2013-05-26 20:15
2013-05-27 17:20
2013-05-28 10:31
2013-05-28 16:32