The GATE Grind

GATE 2012 CS (CS1) – Question 15

Algorithms · Asymptotic Analysis and Time/Space Complexity · 1 mark · Multiple choice

Find the worst-case search time in a balanced BST with $n2^n$ elements.

  1. $\Theta(n\log n)$
  2. $\Theta(n2^n)$
  3. $\Theta(n)$
  4. $\Theta(\log n)$

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (C) $\Theta(n)$

Explanation

A balanced BST search takes Θ(log N) for N elements. Here $\log(n2^n)=\log n+n\log2=\Theta(n)$. Thus option C. The exponential element count still produces only linear-in-n tree height.

More Asymptotic Analysis and Time/Space Complexity questions

All Asymptotic Analysis and Time/Space Complexity questions →