Question: Write a program in C++ which compares the execution time of Recursive and Iterative algorithms of the Fibonacci sequence using a function pointer . The
Write a program in C++ which compares the execution time of Recursive and Iterative algorithms of the Fibonacci sequence using a function pointer. The Fibonacci sequence is defined as follows:
fn = fn-1 + fn-2 where n > 1
f1= 1
f0 = 0.
Compare the execution time of the above approaches for n = 25.
The output should look as follows:
Your name
CIS 5
Spring, 2018
The sequence
0, 1, 1, 2, 3, 5 ......
Recursive 0.001
Iterative .0.002
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
