Question

Solve the following recurrence relation T(1) = c1 T(n) = 2*T(n/2) + c2

Solve the following recurrence relation

T(1) = c1

T(n) = 2*T(n/2) + c2

Homework Answers

Answer #1

T(1) = c1

T(n) = 2*T(n/2) + c2

Solution:

T(n) = 2*T(n/2) + c2 T(n/2) = 2*T(n/4) + c2

= 2*(2*T(n/4) + c2) + c2

= 4*T(n/4) + 3c2    T(n/4) = 2*T(n/8) + c2

= 4*(2*T(n/8) + c2) + 3c2

= 8*T(n/8) + 7c2 T(n/8) = 2*T(n/16) + c2

= 8*(2*T(n/16) + c2) + 7c2

= 16*T(n/16) + 15c2 T(n/16) = 2*T(n/32) + c2

= 16*(2*T(n/32) + c2 ) + 15c2

= 32*T(n/32) + 31c2

= .......

= 2k*T(n/2k) + (2k - 1)c2

T(1) = c1

T(n) = 2*T(n/2) + c2

T(n) = 2k*T(n/2k) + (2k - 1)c2

We need to get off T(n/2k) using T(1)

n/2k = 1

n = 2k

lg (n) = k

T(n) = 2lg (n) *T(n/2lg (n) ) + (2lg (n) - 1)c2

= nT(n/n) + (n - 1)c2

= nT(1) + (n - 1)c2

= nc1 + (n - 1)c2

  

 
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Given the following recurrence relation, convert to T(n) and solve using the telescoping method. T(2n) =...
Given the following recurrence relation, convert to T(n) and solve using the telescoping method. T(2n) = T(n) + c1 for n > 1, c2 for n = 1
Solve the Recurrence Relation T(n) = 2T(n/3) + 2, T(1) = 1
Solve the Recurrence Relation T(n) = 2T(n/3) + 2, T(1) = 1
Solve the following recurrence relation using the technique of unrolling T(n) <= 2*T(n/2) + n*log(n), given...
Solve the following recurrence relation using the technique of unrolling T(n) <= 2*T(n/2) + n*log(n), given T(n <= 2) = 1
Solve the recurrence relation using the substitution method: 1. T(n) = T(n/2) + 2n, T(1) =...
Solve the recurrence relation using the substitution method: 1. T(n) = T(n/2) + 2n, T(1) = 1, n is a 2’s power 2. T(n) = 2T(n/2) + n^2, T(1) = 1, n is a 2’s power
Solve the following recurrence relation, subject to the basis. S(1) = 2 S(n) =2S(n/2) + 2n
Solve the following recurrence relation, subject to the basis. S(1) = 2 S(n) =2S(n/2) + 2n
Solve the following recurrence relation, subject to the basis. S(1) = 2 S(n) =2S(n/2) + 2n
Solve the following recurrence relation, subject to the basis. S(1) = 2 S(n) =2S(n/2) + 2n
Solve the following recurrence relation, subject to the basis. S(1) = 2 S(n) = S(n –...
Solve the following recurrence relation, subject to the basis. S(1) = 2 S(n) = S(n – 1) + 2n please explain how you solved this, thank you!
Solve the recurrence relation subject to the following constraints: (a) S(0) = 2. (b) S(n +...
Solve the recurrence relation subject to the following constraints: (a) S(0) = 2. (b) S(n + 1) = 2S(n) + 1
Solve the following recurrence relations: 1. T(n) = T(n/3) + n for n > 1 T(1)...
Solve the following recurrence relations: 1. T(n) = T(n/3) + n for n > 1 T(1) = 1 2. T(n) = 4T(n/2) + n^2 for n > 1 T(1) = 1
Solve the recurrence relation an = 8an−1 − 16an−2 (n ≥ 2) with the initial conditions...
Solve the recurrence relation an = 8an−1 − 16an−2 (n ≥ 2) with the initial conditions a0 = 3 and a1 = 14. Show all your work.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT