Past exam question: 2073 Bhadra (Regular), Q6
Open in the Padhaiko appQuestion
Draw a binary Tree: Preorder F A E K C D H G B In order E A C K F H D B G
Solution
Root and Subtree Partitioning: Root = first element of Preorder = F. Splitting Inorder E A C K | F | H D B G:
- Left Subtree: Inorder
E A C K, PreorderA E K C.- Root
A: left =E; right (K C/C K) has rootKwith left childC.
- Root
- Right Subtree: Inorder
H D B G, PreorderD H G B.- Root
D: left =H; right (G B/B G) has rootGwith left childB.
- Root
Constructed Binary Tree:
F
/ \
A D
/ \ / \
E K H G
/ /
C B
- Preorder check:
F A E K C D H G B(matches). - Inorder check:
E A C K F H D B G(matches). - Postorder traversal:
E C K A H B G D F.
Answer:
The binary tree has root F, left subtree A (left E, right K with left C), and right subtree D (left H, right G with left B).