Complexity Analysis of a Divide-and-Conquer Recurrence

Complexity Analysis of a Divide-and-Conquer Recurrence

Verified Sources
May 26, 2026

In the analysis of divide-and-conquer algorithms, we frequently encounter equations called recurrence relations . These relations describe the running time of an algorithm in terms of its execution time on smaller inputs.

Consider the following recurrence relation:

T(n)=2T(n/4)+n2lognT(n) = 2T(n/4) + n^2 \log n

This equation characterizes an algorithm that divides a problem of size nn into 22 subproblems of size n/4n/4, solving them recursively, and combines the results in n2lognn^2 \log n non-recursive step time. To find the asymptotic complexity of this recurrence, we can visualize the execution flow using a recursion tree:

To solve this systematically, we can apply the Master Theorem .

Footnotes

  1. Recurrence Relations - GeeksforGeeks - Complete guide on solving recurrence relations using recursion trees, substitution, and master methods.

  2. Master Theorem (Analysis of Algorithms) - Wikipedia - Comprehensive overview of the Master Theorem's history, cases, and mathematical formulations.

Master Theorem for Divide-and-Conquer Recurrences

The Master Theorem Framework

The standard Master Theorem is used to solve divide-and-conquer recurrences of the form T(n)=aT(n/b)+f(n)T(n) = aT(n/b) + f(n), where a1a \ge 1 is the number of subproblems, b>1b > 1 is the factor by which the subproblem size is reduced, and f(n)f(n) is the cost of the work done outside the recursive calls .

Footnotes

  1. Master Theorem (Analysis of Algorithms) - Wikipedia - Comprehensive overview of the Master Theorem's history, cases, and mathematical formulations.

Evaluating the Recurrence Step-by-Step

  1. 1
    Step 1

    From the given recurrence relation T(n)=2T(n/4)+n2lognT(n) = 2T(n/4) + n^2 \log n, we identify the parameters:

    • a=2a = 2 (number of subproblems)
    • b=4b = 4 (subproblem size division factor)
    • f(n)=n2lognf(n) = n^2 \log n (non-recursive work) .

    Footnotes

    1. Recurrence Relations - GeeksforGeeks - Complete guide on solving recurrence relations using recursion trees, substitution, and master methods.

  2. 2
    Step 2

    Next, we compute the critical exponent which determines the growth rate of the leaves in the recursion tree: logba=log42=0.5\log_b a = \log_4 2 = 0.5 This means the number of leaves grows at a rate of n0.5=nn^{0.5} = \sqrt{n} .

    Footnotes

    1. CLRS Solutions | Exercise 4.5-1 | Divide-and-Conquer - Detailed textbook solutions illustrating Case 3 Master Method application for quadratic polynomial overheads.

  3. 3
    Step 3

    We compare the non-recursive term f(n)=n2lognf(n) = n^2 \log n with the leaf growth term nlogba=n0.5n^{\log_b a} = n^{0.5}:

    • f(n)=Ω(n0.5+ϵ)f(n) = \Omega(n^{0.5 + \epsilon}) for any ϵ1.5\epsilon \le 1.5.
    • This indicates that the non-recursive work at the root level dominates the overall work, pointing toward Case 3 of the Master Theorem .

    Footnotes

    1. Master Theorem (Analysis of Algorithms) - Wikipedia - Comprehensive overview of the Master Theorem's history, cases, and mathematical formulations.

  4. 4
    Step 4

    For Case 3 to apply, we must satisfy the [regularity condition]{def="A mathematical constraint in Case 3 of the Master Theorem requiring af(n/b) <= cf(n) for some constant c < 1"} for some constant c<1c < 1 and all sufficiently large nn: af(n/b)cf(n)a f(n/b) \le c f(n) Substituting our parameters: 2((n4)2log(n4))cn2logn2 \left( \left(\frac{n}{4}\right)^2 \log\left(\frac{n}{4}\right) \right) \le c n^2 \log n 18n2(lognlog4)cn2logn\frac{1}{8} n^2 (\log n - \log 4) \le c n^2 \log n Choosing c=1/8=0.125<1c = 1/8 = 0.125 < 1 satisfies this condition for all n4n \ge 4 .

    Footnotes

    1. CLRS Solutions | Exercise 4.5-1 | Divide-and-Conquer - Detailed textbook solutions illustrating Case 3 Master Method application for quadratic polynomial overheads.

  5. 5
    Step 5

    Since Case 3 is verified, the non-recursive work f(n)f(n) dominates the recurrence. Thus, the overall time complexity is: T(n)=Θ(f(n))=Θ(n2logn)T(n) = \Theta(f(n)) = \Theta(n^2 \log n) This matches option (iii) .

    Footnotes

    1. Master Theorem: Practice Problems and Solutions - University of Western Ontario - Academic problem set demonstrating the application of various Master Theorem cases to recurrence relations.

The Power of Dominance

Whenever the non-recursive cost f(n)f(n) is polynomially larger than the leaf cost nlogban^{\log_b a}, the root level does almost all the work. The work decreases geometrically as you go down the tree, meaning the total time complexity is simply determined by the root's cost, T(n)=Θ(f(n))T(n) = \Theta(f(n)) .

Footnotes

  1. Master Theorem: Practice Problems and Solutions - University of Western Ontario - Academic problem set demonstrating the application of various Master Theorem cases to recurrence relations.

Comparison of Leaf Cost vs. Non-Recursive Cost

Visualizing the divergence between leaf cost sqrt(n) and non-recursive cost n^2 log n

Mathematical Proofs and Alternative Methods

Knowledge Check

Question 1 of 3
Q1Single choice

What is the correct asymptotic complexity of the recurrence relation T(n)=2T(n/4)+n2lognT(n) = 2T(n/4) + n^2 \log n?