Skip to content
Official PYQ · 2024

GATE CS 2024 Set 2 Q5 — Asymptotic Worst Case Time and Space Complexity

Explain with AI

​​​​​Let T(n)\text{T(n)} be the recurrence relation defined as follows:

T(0)=1,T(1)=2, and T(n)=5T(n−1)−6T(n−2) for n≥2\begin{array}{l} T(0)=1, \\ T(1)=2, \text{ and } \\ T(n)=5 T(n-1)-6 T(n-2) \text{ for } n \geq 2 \end{array}

Which one of the following statements is TRUE?

Choose one option
View worked solution

Answer: A

The given recurrence relation is a second-order linear homogeneous recurrence relation with constant coefficients:

T(n)−5T(n−1)+6T(n−2)=0T(n) - 5T(n-1) + 6T(n-2) = 0

Step 1: Find the Characteristic Equation

The characteristic equation associated with this recurrence is:

r2−5r+6=0r^2 - 5r + 6 = 0

Factoring the quadratic equation:

(r−2)(r−3)=0(r - 2)(r - 3) = 0

Thus, the characteristic roots are r1=2r_1 = 2 and r2=3r_2 = 3.

Step 2: Formulate the General Solution

Since the roots are distinct, the general solution is of the form:

T(n)=c12n+c23nT(n) = c_1 2^n + c_2 3^n

Step 3: Solve for Constants using Initial Conditions

We are given the initial conditions T(0)=1T(0) = 1 and T(1)=2T(1) = 2. Substituting these into the general solution:

  1. For n=0n = 0: T(0)=c120+c230  ⟹  c1+c2=1— (Equation 1)T(0) = c_1 2^0 + c_2 3^0 \implies c_1 + c_2 = 1 \quad \text{--- (Equation 1)}
  2. For n=1n = 1: T(1)=c121+c231  ⟹  2c1+3c2=2— (Equation 2)T(1) = c_1 2^1 + c_2 3^1 \implies 2c_1 + 3c_2 = 2 \quad \text{--- (Equation 2)}

From Equation 1, we have c1=1−c2c_1 = 1 - c_2. Substituting this into Equation 2:

2(1−c2)+3c2=22(1 - c_2) + 3c_2 = 2 2−2c2+3c2=22 - 2c_2 + 3c_2 = 2 2+c2=2  ⟹  c2=02 + c_2 = 2 \implies c_2 = 0

Substituting c2=0c_2 = 0 back into Equation 1 gives:

c1=1c_1 = 1

Step 4: Determine the Asymptotic Complexity

Substituting the values of c1c_1 and c2c_2 back into the general solution:

T(n)=1⋅2n+0⋅3n=2nT(n) = 1 \cdot 2^n + 0 \cdot 3^n = 2^n

Therefore, the asymptotic tight bound is:

T(n)=Θ(2n)T(n) = \Theta(2^n)

Hence, Option A is the correct statement.

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

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