ISRO Scientist/Engineer CSE 2020Data Structures › Binary Trees and Binary Search Trees
ISRO Scientist/Engineer CSE 2020 PYQ: The post-order traversal of binary tree is $\text{ACEDBHIGF}$. The pre-order traversal is
The post-order traversal of binary tree is $\text{ACEDBHIGF}$. The pre-order traversal is
- A$\text{A B C D E F G H I}$
- B$\text{F B A D C E G I H}$Correct answer
- C$\text{F A B C D E G H I}$
- D$\text{A B D C E F G I H}$
Answer
(B) $\text{F B A D C E G I H}$
Approach
Given postorder ACEDBHIGF, the root is F, so the preorder must start with F. The left subtree postorder ends at B (last node before the right subtree HIG), so the preorder after F must begin with B. Option B matches: F B A D C E G I H. Reconstructing: left subtree preorder B A D C E and postorder A C E D B; right subtree preorder G I H and postorder H I G. Both are valid. Options C and D start with A, impossible because root is F; option A also starts with A. Although a single traversal cannot uniquely determine a tree in general, only one option is consistent with the given postorder.
Reviewed by ISRO IQ Editorial Team.