摘要:
void visit(Node *pRoot){ cout<<pRoot->value<<endl;}void InOrderTraverse(Node *pRoot){ if (!pRoot) return; InOrderTraverse(pRoot->pLeft); visit(pRoot); InOrderTraverse(pRoot->pRight);}EOF 阅读全文
摘要:
void visit(Node *pRoot){ cout<<pRoot->value<<endl;}void PreOrderTraverse(Node *pRoot){ if (!pRoot) return; visit(pRoot); PreOrderTraverse(pRoot->pLeft); PreOrderTraverse(pRoot->pRight);}EOF 阅读全文
摘要:
int Depth(Node *pRoot){ if (!pRoot) return 0; int leftDepth = Depth(pRoot->pLeft); int rightDepth = Depth(pRoot->pRight); return (leftDepth > rightDepth) ? (leftDepth + 1) : (rightDepth + 1);}EOF 阅读全文
摘要:
int GetNodeNum(Node *pRoot){ if (!pRoot) return 0; return GetNodeNum(pRoot->pLeft) + GetNodeNum(pRoot->pRight) + 1;}EOF 阅读全文
摘要:
http://blog.csdn.net/walkinginthewind/article/details/7518888 阅读全文