摘要: 输入二叉树的先序遍历序列和中序遍历序列,输出该二叉树的后序遍历序列。(非建二叉树版本) #include#includeusing namespace std;string preord, inord;void rebuild (int preleft, int preright, int i... 阅读全文
posted @ 2013-04-24 17:49 N3verL4nd 阅读(207) 评论(0) 推荐(0)
摘要: 已知一个按先序序列输入的字符序列,如abc,,de,g,,f,,,(其中逗号表示空节点)。请建立二叉树并按中序和后序方式遍历二叉树,最后求出叶子节点个数和二叉树深度。 #include#include#include #include using namespace std;typedef st... 阅读全文
posted @ 2013-04-24 12:24 N3verL4nd 阅读(235) 评论(0) 推荐(0)