Recrrence Relations, Masters Theorem
Recrrence Relations, Masters Theorem
Recurrence Relation:
1. Iteration Method
3. Mastrer’s Method
1. Iteration Method
We expand the recurrence and express it as a
summation of terms of n and initial condition.
= n x log2n + θ (n)
= nlog2n + θ (n)
= θ (nlog2n)
3. Master’s Method
Master’s theorem is another method to solve recurrence relations
So, we have-
S(m) = S(m/2) +1
Now, we can easily apply Master’s Theorem.
3. Master’s Method…
We compare the given recurrence relation with S(m) = aS(m/b) + θ (mklogpm).
Then, we have- a=1
b=2
k=0
p=0
Now, a = 1 and bk = 20 = 1. Clearly, a = bk.
So, we follow case-2.
Since p = 0, so we have-
S(m) = θ (mlogba.logp+1m)
S(m) = θ (mlog21.log0+1m)
S(m) = θ (m0.log1m)
Thus, S(m) = θ(logm) ……(2)
3. Master’s Method…
Now,
•From (1), we have n = 2m.
•So, logn = mlog2 which implies m = log2n.