GATE / CS ARCHIVE

GATE CSE 2012 / QUESTION 5

Balanced search tree with exponential size

Data Structures · Binary Search & Balanced Trees · Full GATE CSE 2012 paper

GATE 2012, Q5 1 mark · MCQ
Report issue

Binary Search & Balanced Trees

Question 5, GATE 2012: What is the worst-case search time in a balanced binary search tree containing n·2^n elements?
(A) Θ(n log n) (B) Θ(n·2^n) (C) Θ(n) (D) Θ(log n).
Tap to enlarge
Your answer
Answer & solution

Official answer: C

A balanced binary search tree on N elements has worst-case search length Θ(log N). Here N=n·2n, so log₂N=log₂n+n=Θ(n). The answer is C, not Θ(log n), since n itself is not the number of elements.

Check: Search follows just one root-to-leaf branch and performs constant work per visited node. With base-two logarithms, n≤log₂(n2n)≤2n for n≥2, explicitly establishing matching linear upper and lower asymptotic bounds.

Original paper, page 2 · Answer key