Question: Please use Python as the language to solve this set of problems. Thank you. Part 1 Implement two separate programs that generate the n-th Fibonacci

 Please use Python as the language to solve this set of

Please use Python as the language to solve this set of problems. Thank you.

Part 1 Implement two separate programs that generate the n-th Fibonacci number. The programs should both take n as command line input. The first algorithm one should implement the recursive algorithm (fib1 on Page 3 of the textbook), and the second one should implement the iterative algorithm (fib2 on Page 4). You should measure the time it takes for each of these versions (use for example, the timeit module in python) to calculate the n-th Fibonacci number for the following values of n: 1, 5, 10, 15, 20, 25, 30, 35, 40, 41, 42, 43. Finally, create a table of all your results and plot (using for example, the matplotlib library) the time taken to compute the Fibonacci numbers using fib1 and fib2, with n on the x-axis and time on the y-axis

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!