Question
Download Solution PDFWhich of the following is the solution of the following recurrence relation T(n) = T(2n/3) + 1?
Answer (Detailed Solution Below)
Option 2 : θ(log n)
Detailed Solution
Download Solution PDFThe correct answer is : option 2.
Key Points
Explanation of the Recurrence Relation Solution
Given the recurrence relation: T(n) = T(2n/3) + 1
To solve this, we will use the Master Theorem for divide-and-conquer recurrences of the form:
T(n) = aT(n/b) + f(n)
In our case, a = 1
, b = 3/2
, and f(n) = 1
.
Using the Master Theorem, we compare f(n)
with n^log_b(a)
:
a = 1
b = 3/2
log_b(a) = log(1) / log(3/2) = 0
f(n) = 1
Since f(n) = 1
is Θ(1)
, it matches the case where f(n) = Θ(n^c)
with c = 0
. This corresponds to case 2 of the Master Theorem, where f(n)
is polynomially smaller than n^log_b(a)
.
Therefore, the solution to the recurrence is:
T(n) = Θ(log n)
Thus, the correct answer is option 2.