int TreeDepth(BinaryTreeNode* pRoot)
{
if(pRoot==nulllptr)
return 0;
int nLeft=TreeDepth(pRoot->m_pLeft);
int nRight=TreeDepth(pRoot->m_pRight);
return(nLeft>nRight)?(nLeft+1):(nRight+1);
}
二叉树的深度
最新推荐文章于 2022-07-28 22:22:05 发布