函数递归的几个例子

1.求二叉树的深度

int TreeDepth(binary_Tree* pRoot)
{
    if(pRoot==NULL)
        return 0;
    int nLeft=TreeDepth(pRoot->left);
    int nRight=TreeDepth(pRoot->right);
    return (nLeft>nRight) ? (nLeft+1):(nRight+1)
}
原文地址:https://www.cnblogs.com/XDJjy/p/3947847.html