The pre-order traversal of a binary search tree is given by . Then the post-order traversal of this tree is
View worked solution
Answer: B
For any Binary Search Tree (BST), the in-order traversal is always sorted in ascending order. Sorting the given pre-order elements gives the in-order traversal:
Using the given pre-order traversal (), we can reconstruct the tree recursively:
- The first element of the pre-order traversal, , is the root.
- Elements smaller than form the left subtree: . Its pre-order is , making the root. Following this recursively, the post-order for the left subtree is:
- Elements larger than form the right subtree: . Its pre-order is , making the root. Following this recursively, the post-order for the right subtree is:
Combining these with the root () at the end (since post-order is ), we get:
This matches Option B.
Free practice · Your answers on this page are not saved.
