摘要: 编程之美3.9:给出前序遍历和中序遍历,重新创建二叉树,后序遍历输出。代码如下:View Code 1 #include <iostream> 2 #include <cassert> 3 4 using namespace std; 5 6 struct Node 7 { 8 Node* m_lChild; 9 Node* m_rChild; 10 char data; 11 }; 12 13 void AfterTra(Node* pRoot) 14 { 15 if (!pRoot) 16 { 17 retu... 阅读全文
posted @ 2012-06-18 22:34 kasuosuo 阅读(981) 评论(0) 推荐(0) 编辑
摘要: 编程之美3.10节。完整代码如下:View Code 1 #include <iostream> 2 #include <cassert> 3 #include <vector> 4 #include <fstream> 5 #include <stack> 6 #include <queue> 7 using namespace std; 8 9 struct Node 10 { 11 Node* m_lChild; 12 Node* m_rChild; 13 int m_nMaxLeft; 14 int m_nMaxR 阅读全文
posted @ 2012-06-18 17:56 kasuosuo 阅读(190) 评论(0) 推荐(0) 编辑