GATE Computer ScienceHardGATE CS (PYQ pattern)

An adversarial quicksort always splits an input of size n into parts of sizes n/10 and 9n/10, so T(n) = T(n/10) + T(9n/10) + n. For large n, the ratio (depth of the deepest leaf)/(depth of the shallowest leaf) of the recursion tree is approximately:

  1. A. 9
  2. B. 10
  3. C. 21.9
  4. D. 2.3

Correct answer: C. 21.9

Shallowest leaf: log₁₀ n. Deepest leaf: log_{10/9} n. Their ratio is ln 10 / ln(10/9) = 2.3026/0.10536 ≈ 21.9. The naive 9 or 10 comes from comparing the split ratios instead of the logarithm bases.

More Algorithms questions

Exams that ask this topic