- Category:
- Windows Develop
- Tags:
-
- File Size:
- 16kb
- Update:
- 2017-11-27
- Downloads:
- 0 Times
- Uploaded by:
- 杨清山
Description: description
In general, given the binary traversal of preorder sequences and postorder traversal sequences, it is not certain that the binary tree will be uniquely identified.
But for a "true binary tree" (a binary tree with two children per internal node), given its preorder, postorder traversal sequence is sufficient to completely determine its structure.
The n nodes of the binary tree are numbered with integers in [1, n], enter the preorder and postorder traversal sequences of a true binary tree, and then output its sequence traversal sequence.
input
The first line is an integer n, which is the number of nodes in the binary tree.
The second and third acts are known as preorder, postorder traversal sequences.
Output
Only one row, given sequence of true binary tree traversal.
ps: from PA of professor Deng Junhui's DAS lecture of Tsinghua University
To Search:
File list (Check if you may need any files):
Filename | Size | Date |
---|
rebuild2-3-2.cpp | 2454 | 2017-11-27
|
rebuild2-3-2\ListNode.h | 1435 | 2017-10-30
|
rebuild2-3-2\binnode.h | 10814 | 2017-11-05
|
rebuild2-3-2\list.h | 14293 | 2017-11-05
|
rebuild2-3-2\queue.h | 614 | 2017-10-30
|
rebuild2-3-2\rebuild2-3-2.cpp | 2045 | 2017-11-05
|
rebuild2-3-2\stack.h | 591 | 2017-10-30
|
rebuild2-3-2\vector.h | 13071 | 2017-10-29
|
rebuild2-3-2 |