CUET PG 2026 — DSA PYQ
CUET PG | DSA | 2026What is the asymptotic upper bound for the non-standard recurrence relation T(n)=T(n)+1?
Choose the correct answer:
- A.
O(n)
- B.
O(n)
- C.
O(logn)
- D.
O(loglogn)
O(loglogn)
Explanation
To solve the recurrence T(n)=T(n)+1, we use domain transformation:
Step 1: Substitution / Change of variable
Let n=2m, which means m=log2n.
Since n=n1/2=(2m)1/2=2m/2, substitute this into the recurrence relation:
T(2m)=T(2m/2)+1
Step 2: Rename the function
Let S(m)=T(2m). The equation becomes:
S(m)=S(m/2)+1
Step 3: Solve S(m) using Master Theorem
For S(m)=aS(m/b)+f(m):
a=1
b=2
f(m)=1
Calculate mlogba=mlog21=m0=1.
Since f(m)=Θ(1)=Θ(mlogba), by Case 2 of the Master Theorem:
S(m)=Θ(logm)=O(logm)
Step 4: Substitute back to n
Since m=log2n:
T(n)=O(log(logn))=O(loglogn)
Correct Answer: (D) O(loglogn)
Explanation
To solve the recurrence T(n)=T(n)+1, we use domain transformation:
Step 1: Substitution / Change of variable
Let n=2m, which means m=log2n.
Since n=n1/2=(2m)1/2=2m/2, substitute this into the recurrence relation:
T(2m)=T(2m/2)+1
Step 2: Rename the function
Let S(m)=T(2m). The equation becomes:
S(m)=S(m/2)+1
Step 3: Solve S(m) using Master Theorem
For S(m)=aS(m/b)+f(m):
a=1
b=2
f(m)=1
Calculate mlogba=mlog21=m0=1.
Since f(m)=Θ(1)=Θ(mlogba), by Case 2 of the Master Theorem:
S(m)=Θ(logm)=O(logm)
Step 4: Substitute back to n
Since m=log2n:
T(n)=O(log(logn))=O(loglogn)
Correct Answer: (D) O(loglogn)
