摘要:
typedef struct TreeNode{int value;TreeNode * left;TreeNode * right;}TreeNode;void CreateTree( TreeNode * & pTreeNode, int value){if( pTreeNode == NULL){pTreeNode = (TreeNode *) new TreeNode;pTreeNode ->left = NULL;pTreeNode ->right = NULL;pTreeNode ->value = value;}else if( pTreeNode -& 阅读全文
摘要:
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);} 阅读全文