摘要: 1、先序序列确定根节点 2、后序序列区分左右子树 #include<iostream> #include<algorithm> #include<vector> #include<math.h> #include<stdio.h> #include<string.h> #include<map> # 阅读全文
posted @ 2019-11-28 16:38 知道了呀~ 阅读(1344) 评论(0) 推荐(0) 编辑
摘要: 代码: #include<iostream> #include<algorithm> #include<vector> #include<math.h> #include<stdio.h> #include<string.h> #include<map> #include<queue> #inclu 阅读全文
posted @ 2019-11-28 16:32 知道了呀~ 阅读(4460) 评论(0) 推荐(0) 编辑
摘要: 已知前序遍历序列和中序遍历序列,可以唯一确定一棵二叉树。 已知后序遍历序列和中序遍历序列,可以唯一确定一棵二叉树。 但是已知前序遍历序列和后序遍历序列,是不能确定一棵二叉树的。 下面例子通过前序遍历和中序遍历确定唯一的一棵二叉树。 前序遍历:EACBDGF 中序遍历:ABCDEFG 1、首先根据前序 阅读全文
posted @ 2019-11-28 16:02 知道了呀~ 阅读(6355) 评论(0) 推荐(1) 编辑