Binary Search Tree · Data Structures
32 questions · asked in 17 of 27 years (2000–2026)
MCQ 26 · MSQ 2 · NAT 41-mark 20 · 2-mark 12
Questions 31–32 of 32
Answer: (C)
An in-order traversal of a binary search tree lists the elements from smallest to largest.
So the correct option is C
Then ,
where is
Answer: (B)
The sum takes each key in turn as the root. If the root is the -th smallest of the keys, then the smaller keys must go to the left sub-tree and the remaining larger keys must go to the right sub-tree.
The left sub-tree can be any BST on its keys, which gives ways. The right sub-tree can be any BST on its keys, which gives ways. The two choices are independent, so they multiply, and a change in just one sub-tree gives a different tree. So:
Check: the root takes 1 node, so , which gives . The other options, such as , would make the node count more than .
Answer: (B)
Keep practising