照例先上题目:
1:Pre-Post-erous!
查看 提交 统计 提问
总时间限制: 1000ms 内存限制: 65536kB
描述
We are all familiar with pre-order, in-order and post-order traversals of binary trees. A common problem in data structure classes is to find the pre-order traversal of a binary tree when given the in-order and post-order traversals. Alternatively, you can find the post-order traversal when given the in-order and pre-order. However, in general you cannot determine the in-order traversal of a tree when given its pre-order and post-order traversals. Consider the four binary trees below:
a a a a
/ / \ \
b b b b
/ \ / \
c c c c
All of these trees have the same pre-order and post-order traversals. This phenomenon is not restric