GATE Computer ScienceVery hardGATE CS (PYQ pattern)

The running time satisfies T(n) = T(n/2) + T(n/3) + T(n/6) + n. Which bound is tight?

  1. A. Θ(n)
  2. B. Θ(n^(log₂3))
  3. C. Θ(n²)
  4. D. Θ(n log n)

Correct answer: D. Θ(n log n)

The fractions 1/2 + 1/3 + 1/6 sum to exactly 1, so every level of the tree costs n and the depth is Θ(log n) (the shortest path is log₆ n, the longest log₂ n). Dropping T(n/6) would give Θ(n).

More Algorithms questions

Exams that ask this topic