Solve the following recurrences where T(1) = 1
D) T(n) = 2T(n/2) + n^2
F) T(n) = 2T(n-1) + n
T(n) = T(n/2) + n^2 = T(n/4) + n^2/4 + n^2 = T(n/8) + n^/16 + n^2/4 + n^2 = T(n/16) + n^/64 + n^/16 + n^2/4 + n^2 = 1 + ... + n^2/16 + n^2/4 + n^2 = n^2 + n^2/4 + n^2/16 + ... = n^2(1+1/4+1/16+...) = O() T(n) = 2T(n-1) + n = 2(2T(n-2)+(n-1)) + 1 = 2^2T(n-2)+ 2(n-1) + 1 = 2^3T(n-3)+ 4(n-2) + 2(n-1) + 1 ..... ..... = 2^nT(n-n)+ ... + 2^2(n-2) + 2(n-1) + 1 = 2^nT(0)+ ... + 2^2(n-2) + 2(n-1) + 1 = 2^n+ ... + 2^2(n-2) + 2(n-1) + 1 = 2^(n+1) - n - 2 = O()
Get Answers For Free
Most questions answered within 1 hours.