二叉树遍历
隨兴
在校研究生,努力奋斗中
展开
-
PAT——1020 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 traversal sequence of the cor...原创 2019-08-30 20:22:05 · 135 阅读 · 0 评论 -
PAT——1086 Tree Traversals Again (25 分)(先序+中序构建二叉树)
1086Tree 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 ...原创 2019-08-30 20:24:05 · 172 阅读 · 0 评论 -
PAT——1119 Pre- and Post-order Traversals (30 分)(给定先序和后序序列,判断能否构建一颗唯一的树)
1119Pre- and Post-order Traversals(30分) Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder t...原创 2019-08-30 20:27:24 · 266 阅读 · 0 评论 -
PAT——1127 ZigZagging on a Tree (30 分)(BFS遍历树)
1127ZigZagging on a Tree(30分) Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder traversal s...原创 2019-08-30 20:50:10 · 191 阅读 · 0 评论