Question
On a platform of your choice, implement the three different methods for computing the Fibonacci numbers (recursive, iterative, and matrix) discussed in lecture. Use integer
On a platform of your choice, implement the three different methods for computing the Fibonacci
numbers (recursive, iterative, and matrix) discussed in lecture. Use integer variables. How fast does
each method appear to be? Give precise timings if possible. (This is deliberately open-ended; give
what you feel is a reasonable answer. You will need to figure out how to time processes on the system
you are using, if you do not already know.) Can you determine the first Fibonacci number where you
reach integer overflow? (If your platform does not have integer overflow lucky you! you might
see how far each process gets after five minutes.)
Since you should reach integer overflow with the faster methods quite quickly, modify your programs
so that they return the Fibonacci numbers modulo 65536 = 216. (In other words, make all of your
arithmetic modulo 216 this will avoid overflow! You must do this regardless of whether or not your
system overflows.) For each method, what is the largest Fibonacci number you can compute in one
minute of machine time?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started