Asymptotic Analysis and Recurrence Relations Notes for Gate Cs
Asymptotic Analysis and Recurrence Relations notes for GATE CS: 26 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practice que
Asymptotic Analysis and Recurrence Relations notes
Anatomy of an Algorithmic Recurrence
Anatomy of an Algorithmic Recurrence
An algorithmic recurrence relation expresses the running time of a recursive algorithm in terms of the running time on smaller inputs.
1. Base Case
The time complexity for the smallest possible input size (e.g., T(1)=Θ(1)).
2. Recursive Step
Time for input n, expressed as the sum of time to solve smaller subproblems and time to divide/combine.
Merge Sort: T(n)=2T(n/2)+Θ(n)
The Substitution Method for Recurrences
The Substitution Method
Guess the asymptotic bound, then verify using mathematical induction.
Step 1 & 2: Guess T(n)≤cnlogn and verify base case.
Visualize subproblem costs. Sum horizontally per level, then vertically across all levels.
Level 0: cn2
163cn2
163cn2
163cn2
Level i: cn2(163)i
Total Cost (Geometric Series):
T(n)≤cn2i=0∑∞(163)i=1316cn2⟹Θ(n2)
23 more cards in this chapter
Try a question
Answer it here to see how it works. Nothing is recorded until you sign in.
Question 1
Level 1: Warm-up
Consider the following recurrence relations:
T(n)=2T(n/2)+n
T(n)=2T(n/2)+nlog2n
T(n)=2T(n/2)+log2nn
T(n)=3T(n/4)+n2
How many of these recurrences can be directly solved using the standard Master Theorem without falling into its failure cases or requiring a change of variables?
Question 2
Level 1: Warm-up
How many of the following statements are TRUE for f(n)=n2 and g(n)=n2+n?
f(n)=O(g(n))
f(n)=Ω(g(n))
f(n)=Θ(g(n))
f(n)=o(g(n))
Question 3
Level 1: Warm-up
Which of the following options lists the functions in strictly increasing order of asymptotic growth rate?
Question 4
Level 1: Warm-up
Which of the following sequences of functions are listed in strictly increasing order of asymptotic growth rate?
Question 5
Level 1: Warm-up
What is the minimum integer value of k such that the Master Theorem can be directly applied to the recurrence T(n)=2T(n/2)+nlogkn without violating the polynomial gap conditions?
Question 6
Level 1: Warm-up
Consider the recurrence T(n)=2T(n/2)+lognn. Which of the following statements is TRUE regarding the asymptotic bound?
Question 7
Level 1: Warm-up
Match the recurrence relation in List I with the correct Master Theorem case in List II by eliminating the incorrect cases.
List I:
T(n)=2T(n/2)+n
T(n)=3T(n/3)+n2
T(n)=4T(n/2)+n
List II:
P. Case 1 (Leaves dominate)
Q. Case 2 (Balanced)
R. Case 3 (Root dominates)
Question 8
Level 1: Warm-up
Reverse-engineer the applicability of the Master Theorem. How many of the following recurrences can be directly solved using the standard Master Theorem?
T(n)=2T(n/2)+nlogn
T(n)=2T(n/2)+lognn
T(n)=4T(n/2)+n2
T(n)=3T(n/3)+n
Question 9
Level 1: Warm-up
A student asserts that the Master Theorem Case 2 applies to the recurrence T(n)=aT(n/2)+n for all valid integer values of a≥1. What is the minimum integer value of a that proves this assertion false?
Question 10
Level 1: Warm-up
Consider the recurrence T(n)=2T(n/2)+n/logn. A student claims: "Since n/logn=O(n), the Master Theorem Case 1 applies, giving T(n)=Θ(n)." Which of the following correctly evaluates this claim?
Free preview ends here
Login to view the complete notes
Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.
Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.
Built around you, not around a syllabus PDF
Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.
Revision that hits your weak spots
We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.
Questions calibrated to the real exam
Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.
Notes written for recall, not for volume
Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.
One place for everything
Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.
Honest progress
No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.
Unlock the whole course
Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.
Asymptotic Analysis and Recurrence Relations Notes for GATE CS
Asymptotic Analysis and Recurrence Relations notes for GATE CS: 26 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practice questions.
Anatomy of an Algorithmic Recurrence
Anatomy of an Algorithmic Recurrence
An algorithmic recurrence relation expresses the running time of a recursive algorithm in terms of the running time on smaller inputs.
1. Base Case
The time complexity for the smallest possible input size (e.g., T(1)=Θ(1)).
2. Recursive Step
Time for input n, expressed as the sum of time to solve smaller subproblems and time to divide/combine.
Merge Sort: T(n)=2T(n/2)+Θ(n)
The Substitution Method for Recurrences
The Substitution Method
Guess the asymptotic bound, then verify using mathematical induction.
Step 1 & 2: Guess T(n)≤cnlogn and verify base case.
Visualize subproblem costs. Sum horizontally per level, then vertically across all levels.
Level 0: cn2
163cn2
163cn2
163cn2
Level i: cn2(163)i
Total Cost (Geometric Series):
T(n)≤cn2i=0∑∞(163)i=1316cn2⟹Θ(n2)
The Master Theorem for Divide and Conquer
The Master Theorem
For T(n)=aT(n/b)+f(n), compare f(n) against critical function nlogba.
Case 1: Leaves Dominate
f(n)=O(nlogba−ϵ)
T(n)=Θ(nlogba)
Case 2: Balanced
f(n)=Θ(nlogbalogkn)
T(n)=Θ(nlogbalogk+1n)
Case 3: Root Dominates
f(n)=Ω(nlogba+ϵ) + regularity
T(n)=Θ(f(n))
Asymptotic Analysis and Recurrence Relations: Solved Questions with Step-by-Step Explanations (10 Problems)
Question 1 · AlgorithmsMCQ
Consider the following recurrence relations:
T(n)=2T(n/2)+n
T(n)=2T(n/2)+nlog2n
T(n)=2T(n/2)+log2nn
T(n)=3T(n/4)+n2
How many of these recurrences can be directly solved using the standard Master Theorem without falling into its failure cases or requiring a change of variables?
A.
1
B.
2
C.
3
D.
4
Correct Answer:
C
Step-by-Step Solution
Key idea: The Master Theorem applies when f(n) and the critical function nlogba have a polynomial gap, or match exactly with a log factor.
Step 1: For T(n)=2T(n/2)+n, critical is n. f(n)=n matches exactly. Case 2 applies. (Works)
Step 2: For T(n)=2T(n/2)+nlog2n, critical is n. f(n)=nlogn matches with k=1. Case 2 applies. (Works)
Step 3: For T(n)=2T(n/2)+log2nn, critical is n. f(n)=n/logn is smaller, but only by a logarithmic factor, not a polynomial one. Master Theorem fails. (Fails)
Step 4: For T(n)=3T(n/4)+n2, critical is nlog43≈n0.79. f(n)=n2 is polynomially larger. Case 3 applies. (Works)
Step 5: Recurrences 1, 2, and 4 work. Total count is 3.
Answer: C
Question 2 · AlgorithmsMCQ
How many of the following statements are TRUE for f(n)=n2 and g(n)=n2+n?
f(n)=O(g(n))
f(n)=Ω(g(n))
f(n)=Θ(g(n))
f(n)=o(g(n))
A.
1
B.
2
C.
3
D.
4
Correct Answer:
C
Step-by-Step Solution
Key idea: Big-Theta implies both Big-O and Big-Omega, while little-o requires a strictly slower growth rate.
Step 1: Compare f(n)=n2 and g(n)=n2+n. As n→∞, the n term becomes negligible.
Step 2: f(n)=O(g(n)) is TRUE because n2≤c(n2+n) for c=1.
Step 3: f(n)=Ω(g(n)) is TRUE because n2≥c(n2+n) for c=1/2 and large n.
Step 4: Since both O and Ω hold, f(n)=Θ(g(n)) is TRUE.
Step 5: f(n)=o(g(n)) is FALSE because they grow at the exact same rate (the limit of their ratio is 1, not 0).
Step 6: Exactly 3 statements are true.
Answer: C
Question 3 · AlgorithmsMCQ
Which of the following options lists the functions in strictly increasing order of asymptotic growth rate?
A.
logn,n,nlogn,n2,2n
B.
n,logn,n2,nlogn,2n
C.
logn,n,2n,nlogn,n2
D.
nlogn,logn,n,n2,2n
Correct Answer:
A
Step-by-Step Solution
Key idea: Use the standard asymptotic growth hierarchy to order functions from slowest to fastest.
Step 1: Recall the standard hierarchy: 1≪logn≪n≪nlogn≪n2≪nk≪cn≪n!≪nn.
Step 2: Check Option A: logn≪n≪nlogn≪n2≪2n. This perfectly matches the hierarchy.
Step 3: Check Option B: Incorrectly places n before logn.
Step 4: Check Option C: Incorrectly places 2n before nlogn and n2.
Step 5: Check Option D: Incorrectly places nlogn before logn.
Answer: Option A.
Question 4 · AlgorithmsMSQ
Which of the following sequences of functions are listed in strictly increasing order of asymptotic growth rate?
A.
logn,n,nlogn,n2
B.
logn,n,n,2n
C.
n,nlogn,nlogn,n2
D.
n,n2,nlogn,2n
Correct Answer:
["A","B"]
Step-by-Step Solution
Key idea: The standard growth hierarchy orders functions from slowest to fastest: logarithmic, fractional polynomial, linear, linearithmic, polynomial, exponential.
Step 1: Check A. logn≪n≪nlogn≪n2. This is strictly increasing.
Step 2: Check B. logn≪n0.5≪n≪2n. This is strictly increasing.
Step 3: Check C. nlogn is super-polynomial and grows faster than n2. The order is wrong.
Step 4: Check D. n2 grows faster than nlogn. The order is wrong.
Answer: A, B
Question 5 · AlgorithmsMCQ
What is the minimum integer value of k such that the Master Theorem can be directly applied to the recurrence T(n)=2T(n/2)+nlogkn without violating the polynomial gap conditions?
A.
-1
B.
0
C.
1
D.
2
Correct Answer:
B
Step-by-Step Solution
Key idea: The Master Theorem's Case 2 applies when the driving function matches the critical function multiplied by a logarithmic factor logkn where k≥0.
Step 1: Identify the critical function for T(n)=2T(n/2)+nlogkn. Here a=2,b=2, so the critical function is nlog22=n1=n.
Step 2: The driving function is f(n)=nlogkn. For Case 2 to apply, f(n) must be Θ(nlogbalogkn), which perfectly matches with k≥0.
Step 3: If k=−1, f(n)=n/logn, which is smaller than n but not polynomially smaller, causing the Master Theorem to fail.
Step 4: Therefore, the minimum integer value for k that allows direct application of the Master Theorem is $0$.
Answer: 0
Question 6 · AlgorithmsMCQ
Consider the recurrence T(n)=2T(n/2)+lognn. Which of the following statements is TRUE regarding the asymptotic bound?
A.
T(n)=Θ(n) because the driving function is bounded above by the critical function.
B.
T(n)=Θ(nloglogn) because the Master Theorem fails and a change of variables is required.
C.
T(n)=Θ(nlogn) because the driving function is bounded below by a polynomial factor.
D.
T(n)=Θ(n2) because the root dominates the recursion tree.
Correct Answer:
B
Step-by-Step Solution
Key idea: When the driving function is smaller than the critical function by only a logarithmic factor, the Master Theorem fails, and a change of variables is needed.
Step 1: Identify a=2,b=2. The critical function is nlog22=n.
Step 2: The driving function is f(n)=n/logn. This is smaller than n, but the difference is a logarithmic factor (logn), not a polynomial factor (nϵ).
Step 3: Because the gap is not polynomial, the Master Theorem's Case 1 does not apply.
Step 4: Using the change of variables n=2m, the recurrence transforms to S(m)=S(m−1)+1/m, which sums to the harmonic series Θ(logm). Back-substituting gives T(n)=Θ(nloglogn).
Answer: T(n)=Θ(nloglogn)
Question 7 · AlgorithmsMCQ
Match the recurrence relation in List I with the correct Master Theorem case in List II by eliminating the incorrect cases.
List I:
T(n)=2T(n/2)+n
T(n)=3T(n/3)+n2
T(n)=4T(n/2)+n
List II:
P. Case 1 (Leaves dominate)
Q. Case 2 (Balanced)
R. Case 3 (Root dominates)
A.
1-Q, 2-R, 3-P
B.
1-P, 2-Q, 3-R
C.
1-Q, 2-P, 3-R
D.
1-R, 2-Q, 3-P
Correct Answer:
A
Step-by-Step Solution
Key idea: Calculate the critical function nlogba for each recurrence and compare it with the driving function f(n) to eliminate incorrect cases.
Step 1: For T(n)=2T(n/2)+n, a=2,b=2. Critical function is nlog22=n. Since f(n)=n matches exactly, this is Case 2 (Q).
Step 2: For T(n)=3T(n/3)+n2, a=3,b=3. Critical function is nlog33=n. Since f(n)=n2 is polynomially larger, this is Case 3 (R).
Step 3: For T(n)=4T(n/2)+n, a=4,b=2. Critical function is nlog24=n2. Since f(n)=n is polynomially smaller, this is Case 1 (P).
Step 4: Matching them gives 1-Q, 2-R, 3-P.
Answer: 1-Q, 2-R, 3-P
Question 8 · AlgorithmsMCQ
Reverse-engineer the applicability of the Master Theorem. How many of the following recurrences can be directly solved using the standard Master Theorem?
T(n)=2T(n/2)+nlogn
T(n)=2T(n/2)+lognn
T(n)=4T(n/2)+n2
T(n)=3T(n/3)+n
A.
1
B.
2
C.
3
D.
4
Correct Answer:
C
Step-by-Step Solution
Key idea: Check each recurrence against the strict conditions of the Master Theorem, specifically looking for polynomial gaps or exact matches.
Step 1: T(n)=2T(n/2)+nlogn. Critical function is n. f(n)=nlogn matches exactly with k=1. Case 2 applies. (Yes)
Step 2: T(n)=2T(n/2)+n/logn. Critical function is n. f(n)=n/logn is smaller by a logarithmic factor. The Master Theorem fails. (No)
Step 3: T(n)=4T(n/2)+n2. Critical function is n2. f(n)=n2 matches exactly with k=0. Case 2 applies. (Yes)
Step 4: T(n)=3T(n/3)+n. Critical function is n. f(n)=n is polynomially smaller. Case 1 applies. (Yes)
Step 5: Count the "Yes" answers. Recurrences 1, 3, and 4 work. The count is 3.
Answer: 3
Question 9 · AlgorithmsMCQ
A student asserts that the Master Theorem Case 2 applies to the recurrence T(n)=aT(n/2)+n for all valid integer values of a≥1. What is the minimum integer value of a that proves this assertion false?
A.
1
B.
2
C.
3
D.
4
Correct Answer:
A
Step-by-Step Solution
Key idea: The Master Theorem requires comparing the driving function f(n) with the critical function nlogba. Case 2 only applies when they match exactly (up to log factors).
Step 1: Identify the parameters. Here b=2 and f(n)=n.
Step 2: Test the minimum valid integer a=1. The critical function is nlog21=n0=1.
Step 3: Compare f(n)=n with the critical function $1$. Since n is polynomially larger than $1$, Case 3 applies, not Case 2.
Step 4: Thus, a=1 contradicts the student's assertion.
Answer: 1
Question 10 · AlgorithmsMCQ
Consider the recurrence T(n)=2T(n/2)+n/logn. A student claims: "Since n/logn=O(n), the Master Theorem Case 1 applies, giving T(n)=Θ(n)." Which of the following correctly evaluates this claim?
A.
True, because the driving function is bounded above by the critical function.
B.
False, the Master Theorem fails due to a logarithmic gap, and the true bound is Θ(nloglogn).
C.
False, the Master Theorem fails, and the true bound is Θ(nlogn).
D.
True, because the leaves dominate the recursion tree.
Correct Answer:
B
Step-by-Step Solution
Key idea: The Master Theorem requires a polynomial gap between f(n) and the critical function. A logarithmic gap causes the theorem to fail.
Step 1: Identify the critical function. For a=2,b=2, it is nlog22=n.
Step 2: Compare f(n)=n/logn with n. The difference is a factor of logn.
Step 3: Recognize that logn is not a polynomial factor nϵ. Thus, Case 1 does not apply.
Step 4: The correct resolution is the change of variables method, which yields T(n)=Θ(nloglogn).
Answer: False, the Master Theorem fails due to a logarithmic gap, and the true bound is Θ(nloglogn).