Reputation: 80
I want to know how to solve this question by iterative method
Upvotes: 1
Views: 51
Reputation: 3736
Since you should do your homework yourself, I'll show you the solution for
n = 8
T(n) = T(8)
= 2T(8/2)+8
= 2T(4)+8
= 2*(2T(4/2)+4)+8
= 2*(2T(2)+4)+8
= 4T(2)+8+8
= 4T(2)+16
= 4*(2T(2/2)+2)+16
= 4*(2T(1)+2)+16
= 8T(1)+4+16
= 8T(1)+20
= 8*1+20
= 28
Upvotes: 1