Consider the recurrence relation T(1) = 0, T(n) = 25T(n/5) +
5n.
(a) Use the Master Theorem to find the order of magnitude of
T(n)
(b) Use any of the various tools from class to find a closed-form
formula for T(n), i.e. exactly solve the recurrence.
(c) Verify your solution for n = 5 and n = 25.
a)
Here, a >= 1, b > 1, k >= 0 and p is a real number.
To solve recurrence relations using Master’s theorem, we compare a with bk.
Then, we follow the following cases-
Case-01:
If a > bk, then T(n) = θ (nlogba)
Case-02:
If a = bk and
Case-03:
If a < bk and
********************************************************************************************
We compare the given recurrence relation with T(n) = aT(n/b) + θ (nklogpn).
Then, we have-
a = 25
b = 5
k = 1
p = 0
Now, a = 25 and bk = 51 = 5.
Clearly, a > bk.
So, we follow case-01.
So, we have-
T(n) = θ (nlogba)
T(n) = θ (nlog525)
T(n) = θ (n2)
Thus,
T(n) = θ (n2) |
Get Answers For Free
Most questions answered within 1 hours.