Bitkernel · Data Structures & Algorithms
Convert binary tree traversals to forest count
TrueInterview
October 7, 2026 · 1 min read
Given a binary tree with these traversal results:
- Inorder:
A, B, C, D, E, F, G - Postorder:
B, D, C, A, F, G, EThe tree is transformed into an equivalent forest using the usual left-child/right-sibling mapping (left child = first child, right child = next sibling). What is the number of trees in the resulting forest? Options: - A.
1 - B.
2 - C.
3 - D.
4Overview: This item tests comprehension of binary tree traversals and the left-child/right-sibling (first-child/next-sibling) representation, requiring you to reconstruct hierarchical relationships from the provided inorder and postorder sequences.
Loading comments…