Skip to content
Official PYQ · 2026

GATE CS 2026 Set 2 Q15 — Asymptotic Worst Case Time and Space Complexity

Explain with AI

Which of the following can be recurrence relation(s) corresponding to an algorithm with time complexity Θ(n)\Theta(n)?

Select all correct options
View worked solution

Answer: A;B

To find which recurrence relations correspond to a time complexity of Θ(n)\Theta(n), we analyze each option individually:

  1. T(n)=T(n−1)+1,T(1)=1T(n) = T(n-1) + 1, \quad T(1) = 1
    Unrolling the recurrence: T(n)=T(n−1)+1=T(n−2)+1+1=⋯=T(1)+(n−1)⋅1T(n) = T(n-1) + 1 = T(n-2) + 1 + 1 = \dots = T(1) + (n-1) \cdot 1 Substituting T(1)=1T(1) = 1: T(n)=1+n−1=n=Θ(n)T(n) = 1 + n - 1 = n = \Theta(n) Thus, Option A is correct.
  2. T(n)=2T(n2)+1,T(1)=1T(n) = 2 T\left(\frac{n}{2}\right) + 1, \quad T(1) = 1
    Using the Master Theorem of the form T(n)=aT(n/b)+f(n)T(n) = a T(n/b) + f(n):
    • Here, a=2a = 2, b=2b = 2, and f(n)=1f(n) = 1.
    • We compare f(n)=1f(n) = 1 with nlog⁡ba=nlog⁡22=n1=nn^{\log_b a} = n^{\log_2 2} = n^1 = n.
    • Since f(n)=O(n1−ϵ)f(n) = O(n^{1-\epsilon}) for ϵ=1\epsilon = 1, we fall into Case 1 of the Master Theorem.
    Therefore: T(n)=Θ(nlog⁡ba)=Θ(n)T(n) = \Theta(n^{\log_b a}) = \Theta(n) Thus, Option B is correct.
  3. T(n)=2T(n2)+n,T(1)=1T(n) = 2 T\left(\frac{n}{2}\right) + n, \quad T(1) = 1
    Using the Master Theorem:
    • Here, a=2a = 2, b=2b = 2, and f(n)=nf(n) = n.
    • We compare f(n)=nf(n) = n with nlog⁡ba=nn^{\log_b a} = n.
    • Since f(n)=Θ(nlog⁡ba)f(n) = \Theta(n^{\log_b a}), we fall into Case 2 of the Master Theorem.
    Therefore: T(n)=Θ(nlog⁡n)T(n) = \Theta(n \log n) Thus, Option C is incorrect.
  4. T(n)=T(n−1)+n,T(1)=1T(n) = T(n-1) + n, \quad T(1) = 1
    Unrolling the recurrence: T(n)=T(n−1)+n=T(n−2)+(n−1)+n=⋯=T(1)+2+3+⋯+nT(n) = T(n-1) + n = T(n-2) + (n-1) + n = \dots = T(1) + 2 + 3 + \dots + n Summing the arithmetic progression: T(n)=n(n+1)2=Θ(n2)T(n) = \frac{n(n+1)}{2} = \Theta(n^2) Thus, Option D is incorrect.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Asymptotic Worst Case Time and Space Complexity questions