Submit | All submissions | Best solutions | Back to list |
EITREORD - Postorder |
Given the pre order traversal and in-order traversal of a binary treee. Build and print the post-order traveral of the given tree.
Input
The first line contains N as the number of vertices (N <= 80 000).
The second line contains N numbers, which are preorder browsing lists.
The third line contains N numbers as the inorder browse list.
Output
Print out the postorder traversal .
Example
Input:66 0 4 2 3 5 1 4 0 5 3 2 10 4 2 3 5 14 0 3 5 2 1Output: 4 5 3 1 2 0
Added by: | Ha Minh Ngoc |
Date: | 2016-01-04 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET |