
重建二叉树
wangfy_
这个作者很懒,什么都没留下…
展开
-
1020 Tree Traversals (25)
Tree Traversals (25) Suppose that all the keys in a binary tree(二叉树) are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order ...原创 2018-03-29 20:12:34 · 208 阅读 · 0 评论 -
ANOJ 1005 还原二叉树
// 层序中序 求先/后序 // ANOJ-180311-D #include <cstdio> const int MAXN = 10010; int n, layer[MAXN], in[MAXN]; struct node { int data; node* l; node* r; }; node* create(int *layer, int *in, int t) ...原创 2018-03-29 20:04:19 · 218 阅读 · 0 评论 -
重建二叉树专题
重建二叉树 ---后序中序-------------------------------------------------------------------------- 【一】PAT-A 170304 原题 D //给出一个树的中序和后序遍历结果,求它的Z字型层序遍历,也就是偶数层从左往右,奇数层从右往左遍历 // 8 // 12 11 20 17 1 15 8 5 中序 // ...原创 2018-04-21 17:21:14 · 154 阅读 · 2 评论 -
1086 Tree Traversals Again (25)
Tree Traversals Again (25) An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1...原创 2018-03-29 20:11:13 · 174 阅读 · 0 评论