
二叉树
文章平均质量分 77
小雪乃
这个作者很懒,什么都没留下…
展开
-
PAT 甲级 1043. Is It a Binary Search Tree (25)
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node's key.The righ原创 2017-09-29 14:38:36 · 179 阅读 · 0 评论 -
PAT 甲级 1102. Invert a Binary Tree (25)
The following is from Max Howell @twitter:Google: 90% of our engineers use the software you wrote (Homebrew), but you can't invert a binary tree on a whiteboard so fuck off.Now it's your turn原创 2017-10-09 15:00:02 · 197 阅读 · 0 评论 -
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原创 2017-09-22 17:05:36 · 170 阅读 · 0 评论 -
PAT 甲级 1110. Complete Binary Tree (25)
PAT 甲级 完全二叉树原创 2017-10-11 10:16:00 · 173 阅读 · 0 评论 -
PAT 甲级 1119. Pre- 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 traversal sequences, or preorder and inorder t原创 2017-10-20 02:21:21 · 272 阅读 · 0 评论 -
PAT 甲级 1086. 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 to 6) is traversed, the stac原创 2017-10-05 18:51:43 · 182 阅读 · 0 评论 -
PAT 甲级 1127. ZigZagging 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 sequences. And it is a simple standa原创 2017-10-23 05:35:36 · 297 阅读 · 0 评论