Skip to content
Mad4Study

Engineering & Science

GATE Computer Science

  • GATE CS
  • 2026–27 pattern practice
  • Algorithms
  • Master theorem
  • Medium

What is the solution of T(n)=4T(n/2)+n2T(n) = 4T(n/2) + n^2?

Asymptotic Analysis

Pick an option to check your answer.

Master theorem with a=4a = 4, b=2b = 2, f(n)=n2f(n) = n^2:

  1. nlog⁡ba=nlog⁡24=n2n^{\log_b a} = n^{\log_2 4} = n^2
  2. f(n)=Θ(nlog⁡ba)f(n) = \Theta(n^{\log_b a}) → case 2
  3. T(n)=Θ(nlog⁡balog⁡n)=Θ(n2log⁡n)T(n) = \Theta(n^{\log_b a}\log n) = \Theta(n^2\log n)

Each of the log⁡n\log n levels of the recursion tree does Θ(n2)\Theta(n^2) work.

Why not the others

  • Θ(n2)\Theta(n^2) ignores the log⁡n\log n levels.
  • Θ(n3)\Theta(n^3) would need f(n)=n3f(n) = n^3 (case 3).
  • Θ(nlog⁡n)\Theta(n\log n) is the answer for 2T(n/2)+n2T(n/2) + n.

Report an error

GATE CS · Algorithms · Asymptotic Analysis