CUET PG 2026 — DSA PYQ
CUET PG | DSA | 2026What is the solution to the recurrence relation T(n)=T(n/2)+1 using the Master Theorem?
Choose the correct answer:
- A.
Θ(1)
- B.
Θ(n)
- C.
Θ(logn)
(Correct Answer) - D.
Θ(nlogn)
Θ(logn)
Explanation
The general form for the Master Theorem recurrence relation is:
T(n)=aT(n/b)+f(n)
From the given recurrence T(n)=T(n/2)+1:
a=1
b=2
f(n)=1=Θ(n0)
Step 1: Calculate nlogba
nlogba=nlog21=n0=1
Step 2: Compare f(n) with nlogba
f(n)=1
nlogba=1
Since f(n)=Θ(nlogba), both f(n) and nlogba grow at the same rate.
Step 3: Apply Case 2 of the Master Theorem
If f(n)=Θ(nlogba), then:
T(n)=Θ(nlogbalogn)
Substituting nlogba=1:
T(n)=Θ(1⋅logn)=Θ(logn)
Correct Answer: (C) Θ(logn)
Explanation
The general form for the Master Theorem recurrence relation is:
T(n)=aT(n/b)+f(n)
From the given recurrence T(n)=T(n/2)+1:
a=1
b=2
f(n)=1=Θ(n0)
Step 1: Calculate nlogba
nlogba=nlog21=n0=1
Step 2: Compare f(n) with nlogba
f(n)=1
nlogba=1
Since f(n)=Θ(nlogba), both f(n) and nlogba grow at the same rate.
Step 3: Apply Case 2 of the Master Theorem
If f(n)=Θ(nlogba), then:
T(n)=Θ(nlogbalogn)
Substituting nlogba=1:
T(n)=Θ(1⋅logn)=Θ(logn)
Correct Answer: (C) Θ(logn)
