I have a recurrence relation of the form T(n) = 2T(n/2) + THETA(n), T(1) = THETA(1). I attempted to prove T(n) <= knlgn by substitution method. I give the solution below. I am VERY new to this so do not know if this is the correct way to go
T(n) = 2T(n/2) + cn
Assumption: T(n) <= knlgn
Base case:
Let T(1) = c
Taking the base case as n = 2, we have
T(2) = 2T(1) + 2c
= 4c
For n=2, knlgn = k2lg2 = 2k
Therefore, for base case of n = 2, T(n) <= knlgn for all n >= 2, c >= 1 and k >= 2, c < k
Assumption: T(n/2) <= kn/2lgn/2
T(n) <= 2kn/2lgn/2 + cn
= knlgn/2 + cn
= knlgn - knlg2 + cn
= knlgn - kn + cn
<= knlgn for all n >= 2, c >= 1 and k >= 2, c < k
The math on this works out correctly as long as i keep c < k

New Topic/Question
Reply
MultiQuote








|