GATE / CS ARCHIVE

GATE CSE 2017 SET 1 / QUESTION 6

GATE CSE 2017 Set 1 Q6

Data Structures · Binary Search & Balanced Trees · Full GATE CSE 2017 Set 1 paper

GATE 2017 Set 1, Q6 1 mark · MCQ
Report issue

Binary Search & Balanced Trees

Question 6, GATE 2017: A binary search tree has 15 nodes. A one-node tree has height 0. Find minimum and maximum heights. A (4,15); B (3,14); C (4,14); D (3,15).
Tap to enlarge
Your answer
Answer & solution

Official answer: B

1. Height counts edges, so levels 0 through h hold at most 1+2+...+2h=2h+1−1 nodes.

2. For 15 nodes, 2h+1−1≥15 requires h≥3. A perfect four-level tree realizes height 3 and can be assigned sorted BST keys.

3. At the other extreme, a one-child chain uses one edge per additional node, giving 14 edges. No simple root-to-leaf path can exceed 14 edges with 15 nodes. Answer B.

Original paper, page 4 · Answer key