Pre-order: 7 2 9 14 16 Post-order: 2 16 14 9 7 In-order: 2 7 9 14 16
ANS: The given solution is correct;
If a pre-order and In-order is given OR a post-order and In-order is given then we can draw a unique binary tree.
pre-order + IN-order = Unique binary tree;
post-order + IN-order =Unique binary tree;
here, pre-order , post -order , In-order is given, so obviously we can draw a unique binary tree.
First of all you need to understand the Traversal:
pre-order: In pre-order traversal , first we write Node , then goto left child and then right child;
The first node of pre-order traversal is always Root node.
Post-order: In post-order traversal , first we goto the left then right , then node;
The last node of post -order is Root node.
In-order: In in-order traversal , first we goto left then node then right;
Step by step
Solved in 2 steps with 2 images