Question

For questions 10-12, refer to the following iterative code computes values for the table t. 1 public int [] tIterative (int [

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

10. One major thing to observe in above table that any entry of t say t[ i ] is dependent upon the entry t[i-1] and t[j] where j < i. Since the table t is getting filled in ascending order of indices, hence for calculating t[i], the dependent values t[i-1] and t[j] where j < i are already calculated, hence the above algorithm is based on dynamic programming, where present index value for t is calculated using previous entries.

11. Here outermost for loop run for n iterations while inner "while" loop run for i-1 iterations in worst case.

Hence the statements in innermost loop will run for O(n2) iterations in worst case.

Hence the worst case time complexity will be O(n2).

Please comment for any clarification.

Add a comment
Know the answer?
Add Answer to:
For questions 10-12, refer to the following iterative code computes values for the table t. 1 pub...
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