GATE Computer ScienceHardGATE CS (PYQ pattern)

Consider T(n) = 2T(n/2) + 8T(n/4) + n² with T(1) = 1 (the subproblem sizes add up to 3n, not n). Which is the tight bound?

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

Correct answer: A. Θ(n² log n)

Akra–Bazzi: find p with 2·(1/2)^p + 8·(1/4)^p = 1. p = 2 works (2/4 + 8/16 = 1). Then T = Θ(n^p (1 + ∫₁ⁿ u²/u³ du)) = Θ(n² log n): f(n) = n² exactly matches n^p, so every level costs about n² and there are Θ(log n) levels.

More Algorithms questions

Exams that ask this topic