I just encountered a problem to find a tree for given inorder and postorder traversals.Can anybody elaborate the same using an example ?
Asked
Active
Viewed 193 times
1 Answers
0
For example, if you have $42513$ and $45231$
You would first realize $1$ is the root, and you have subtrees $425$ and $3$
Now you have reduced to problem to $425$ and $452$, you would realize $2$ is the root and $4,5$ are the children.
So the tree would look like
1---2---4
| |
| 5
3
cr001
- 12,598