ALGORITHMS/Student Engineering Notebook
Page 02·notes
ASYMPTOTIC NOTATIONS & RECURRENCES—~32 MIN READ

Master Theorem, Recurrences & Advanced Recurrence Solvers

“Comparing f(n) with n^{log_b a}, extended Master cases, substitution proofs, and change of variables.”

1.The Divide-and-Conquer Recurrence Framework

The classic divide-and-conquer recurrence has the form: T(n) = a * T(n/b) + f(n), where:

- a >= 1: Number of recursive subproblems generated at each step.

- b > 1: Subproblem size reduction factor (each subproblem has size n/b).

- f(n): Time required to divide the input and combine the subproblem outputs.

The Recursion Tree Model:

At depth j of the recursion tree, there are a^j subproblems, each of size n / b^j. The work at depth j is a^j * f(n / b^j). The total tree depth is log_b n. The number of leaves at the bottom level is a^{log_b n} = n^{log_b a}.

The overall solution is dictated by the race between leaf work (n^{log_b a}) and root work (f(n)).

2.Extended Master Theorem & Non-Standard Transformations

Standard Master Theorem requires a polynomial gap n^epsilon between f(n) and n^{log_b a}. When f(n) differs only by logarithmic factors, the extended theorem applies:

If f(n) = Theta(n^{log_b a} * log^k n):

1. If k > -1: T(n) = Theta(n^{log_b a} * log^{k+1} n).

2. If k = -1: T(n) = Theta(n^{log_b a} * log(log n)).

3. If k < -1: T(n) = Theta(n^{log_b a}).

Change of Variables (Domain Transformation):

For recurrences involving fractional powers like T(n) = 2T(sqrt(n)) + log n:

Substitute n = 2^m (so m = log_2 n and sqrt(n) = 2^{m/2}).

Define S(m) = T(2^m). Then S(m) = 2S(m/2) + m. Apply Master Theorem to S(m): a=2, b=2, m^{log_2 2} = m^1. Case 2 applies: S(m) = Theta(m log m). Substituting back m = log_2 n: T(n) = Theta(log n * log(log n)).

WORKED EXAM ANALYSIS · STEP-BY-STEP DERIVATIONOriginal Practice Problem · Modeled on GATE Pattern (2 Marks)

3. Worked Problem: Multi-Factor Extended Recurrence

⚠️ Pitfall Warning:

Do not confuse Case 1 with Case 2 when logarithmic terms multiply n^{log_b a}. Even if k > 0, if the base power is n^{log_b a}, it belongs strictly to Case 2.

Problem: Find the asymptotically tight bound for T(n) = 4 T(n/2) + n^2 (log_2 n)^2, with T(1) = Theta(1).

Step 1: Identify parameters: a = 4, b = 2, f(n) = n^2 * (log_2 n)^2.

Step 2: Compute critical exponent: n^{log_b a} = n^{log_2 4} = n^2.

Step 3: Compare f(n) with n^{log_b a}:

f(n) = n^2 (log_2 n)^2 = Theta(n^2 log^k n) where k = 2.

Step 4: Check applicability:

Since f(n) is of the form Theta(n^{log_b a} * log^k n) with k = 2 >= 0, Extended Case 2 applies directly.

Step 5: Apply formula:

T(n) = Theta(n^{log_b a} * log^{k+1} n)

T(n) = Theta(n^2 log^{2+1} n) = Theta(n^2 log^3 n).

SOURCE TRANSPARENCY & CITATIONS

Primary Academic References & Exam Sources

Every concept in Notes From a B.Tech Brain is synthesized from authoritative academic texts, seminal peer-reviewed research, verified exam archives, and renowned university lectures.

Curated University Lecture Series
Introduction to Algorithms (4th Edition) ·
LECTURE SERIES
RECOMMENDED YOUTUBE EDUCATORS & FULL-COURSE PLAYLISTS

Curated for clarity, rigorous numerical solving, and semester excellence:

Abdul Bari · Algorithms↗Instructor: Abdul Bari · Covers: Sorting, graph algorithms, dynamic programming, greedy, backtracking

Best visual explanations of algorithm design and complexity analysis.

Open YouTube↗
Gate Smashers · Algorithms for GATE↗Instructor: Varun Singla · Covers: Asymptotic analysis, Master Theorem, DP, Dijkstra, Bellman-Ford

Exam-focused with GATE PYQ numericals on every major algorithm.

Open YouTube↗