微软应聘百题五十二: 求二元树的深度

int PreOrder( TreeNode * pTreeNode, int levNum )
{
if( pTreeNode == NULL)
return levNum;
//printf("%d,", pTreeNode->value );
levNum ++;
int sum1= PreOrder(pTreeNode->left,levNum) ;
int sum2 = PreOrder(pTreeNode->right,levNum);

return (sum1>sum2?sum1:sum2);

}

 

posted @ 2013-08-11 16:15  sorgin  阅读(150)  评论(0编辑  收藏  举报