Consider the traversal of a tree
Preorder → ABCEIFJDGHKL
Inorder → EICFJBGDKHLA
Which of the following is correct post order traversal?
Solution
The correct answer is IEJFCGKLHDBA
Given:
Preorder - ABCEIFJDGHKL
Inorder - EICFJBGDKHLA
Concept:
Since in preorder traversal root is visited first, then left child, later right child.
Explanation:
Given preorder and Inorder we can construct the complete tree as follows:-
we find the root using preorder and we find left and right child using Inorder
New root = B since preorder contains B next.
Now from this tree we find post order traversal, which is IEJFCGKLHDBA






