Invitation to Computer Science 8th Edition

Published by Cengage Learning
ISBN 10: 1337561916
ISBN 13: 978-1-33756-191-4

Chapter 3 - Exercises - Page 140: 3c

Answer

The first algorithm is easy to understand but takes a lot of steps for big numbers like $\mathrm{F}(100) .$ The second one provides us with a shortcut and any value can be found just by plugging in the value for $n$ in the formula. --- The first algorithm is most easily understood since it involves the simplest operation - addition. However, it is not as elegant and efficient as the second one, since it takes up a lot of time if it is not done using a computer. But even considering using a computer, the second algorithm, which involves a known formula, would be far superior in terms of efficiency, especially when looking at greater values like $F(100) .$ It is important to note, that you will hardly get an integer after performing the calculations for the second algorithm on a calculator. You will be limited to the number of digits that your calculator can display. It will look something like this most of the time 6567.000$\ldots $.

Work Step by Step

--
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.