求二叉树节点总数

 

int GetNodeNum(Node *pRoot)
{
    if (!pRoot)
        return 0;
    return GetNodeNum(pRoot->pLeft) + GetNodeNum(pRoot->pRight) + 1;
}

 

 

 

EOF

posted on 2012-12-07 14:20  kkmm  阅读(294)  评论(0编辑  收藏  举报