Solution:
Using substitution method prove that T(n) = 7T(n/2) +
cn2 has O(nlog27)
complexity.
O(nlog27) = O(n2.81)
(approx.)
Substitution Method:
In the substitution method, we make a guess for the solution and then we use mathematical induction to prove the guess is incorrect or correct.
For example consider the recurrence T(n) = 2T(n/2) + n We guess the solution as T(n) = O(nLogn). Now we use inductionto prove our guess. We need to prove that T(n) <= cnLogn. We can assume that it is true for values smaller than n. T(n) = 2T(n/2) + n <= cn/2Log(n/2) + n = cnLogn - cnLog2 + n = cnLogn - cn + n <= cnLogn
Now solving our problem.
T(n) = 7T(n/2) + cn2
As given in the question we guess the solution as O(nlog27). Now we use induction to prove our guess.
We need to prove that T(n) <= cnlog27. We assume that it is true for the values smaller than n.
T(n) = 7T(n/2) + cn2
<= c(n/2)log27 +
cn2
<= c(nlog27 -
2log27) + cn2
As we know that:
blogb(x) =
x. Therefore,
2log27 = 7.
Then,
T(n) <= c(nlog27 - 7) +
cn2
<= cnlog27 - 7c +
cn2
As c is constant therefore assume 7c = c.
So,
T(n) <= cnlog27 + cn2 -
c
As nlog27 >
n2. So we take O(nlog27)
as our solution.
Hence T(n) = O(nlog27) or T(n) =
O(n2.81) is our required solution.
Question 1. Solving Recursive Relations [3 mark]. A naive multiplication of two matrices of order n...