Question

Give the asymptotic bounds for T(n) in each of the following recurrences. Make your bounds as...

Give the asymptotic bounds for T(n) in each of the following recurrences. Make your bounds as tight as possible and justify your answers. Assume the base cases T(0)=1 and/or T(1) = 1.

1. T(n) = T(n-1) + 2n

2. T(n) = T(n-2) = 3

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1.

T(n) = T(n-1) + 2n

= T(n-2) + 2n + 2(n-1)

= T(n-3) + 2n + 2(n-1) + 2(n-3)

..............

= T(n-k) + 2n + 2(n-1) + 2(n-3) + .... + 2(n-k)

For k = n, we get

T(n) = T(0) + 2n + 2(n-1) + 2(n-2) + .... + 2

Hence, T(n) = O(n2) [Since 2n + 2(n-1) + 2(n-2) + .... + 2 is twice the sum of first n natural numbers which is of order n2]

2.

T(n) = T(n-2) = 3

= T(n-4) + 3 + 3

= T(n-6) + 3 + 3 + 3

-------------

= T(n - 2*k) + 3*k

For k = n/2, we get

T(n) = T(0) + 3 * n/2

= O(n)

Add a comment
Know the answer?
Add Answer to:
Give the asymptotic bounds for T(n) in each of the following recurrences. Make your bounds as...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT