Question: Fibonacci Recursion - C++ Measure and compare the running time of recursive and iterative implementations of Fibonacci Numbers Calculation . You do not need to

Fibonacci Recursion - C++

Measure and compare the running time of recursive and iterative implementations of Fibonacci Numbers Calculation. You do not need to implement the algorithms. Feel free to find the source online, or in a book. Please be sure to comment your source.

For example, see website as starting point below:

https://www.codeproject.com/tips/109443/fibonacci-recursive-and-non-recursive-c

You must modify the program to measure the running time of these two algorithms. You can use this reference to measure execution time: http://www.cplusplus.com/reference/ctime/clock/ You can use any other timing mechanism you choose (other than wall clock time).

Before you start, write down expectations. When you measure the running time, start with small values of N and increase N until you can see clear difference of running time (eg: 10, 50, 100). Record your measurements results, then write your analysis. You can list the representative data in a table with three columns: N, recursive time, iterative time. Briefly explain the time difference in these two algorithms.

Tip?You might need a large number of N to see the actual time difference. If you do not want to do that, you can run the same N for multiple times (100 for example) in one measurement (you can use a for loop to do that) and record the start and end time of this loop. Present the results in the form of N (run for 100 times).

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!