Multiple choice

The In-order traversal of a tree is given as B C A E D F and pre-order traversal of tree is given as A B C D E F. What will be the post order traversal order?

  1. C B F E D A

  2. C B E F A D

  3. B C F E D A

  4. C B E F D A

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation
  1. In POST order traversal, first traverse left, then right and then print node. 2. If the sequence to traversal is given then it is easy to predict the tree. In preorder, the node which is traversed first is the root of the tree. So, here A is the root. Now take each node from preorder list and now from list in order the node which is right side of A is right and the node which is on left will come in left. Now traverse one by one each element from the list and make a tree and then find post order traversal from first step. On traversing the tree, we get following sequence for post order: C B E F D A. So the option C B E F D A is correct.