二叉树的深度

public int TreeDepth(TreeNode pRoot)
    {
        if(pRoot == null) return 0;
        return Math.max(TreeDepth(pRoot.left),TreeDepth(pRoot.right))+1;
    
    }

 

posted @ 2016-09-01 09:45  樱圃  阅读(114)  评论(0编辑  收藏  举报