#include <stdio.h>
#include <time.h>
- Author
- Henry M. Walker *
- Date
- August 14, 2022 *
◆ fibSeq1()
compute the nth fibonacci number directly, * using the recursive definition of the sequence *
- Parameters
-
n | the nth Fibonacci number to be computed * (starting the sequence at index 0) * |
- Precondition
- 0 <= n *
- Returns
- the nth Fibonacci number *
◆ fibSeq2()
compute the nth fibonacci number, * using the recursive definition and dynamic programming *
- Parameters
-
n | the nth Fibonacci number to be computed * (starting the sequence at index 0) * |
- Precondition
- 0 <= n *
- Returns
- the nth Fibonacci number *
◆ fibSeq2Helper()
int fibSeq2Helper |
( |
int |
n, |
|
|
int |
fibArr[] |
|
) |
| |
helper function to compute the nth fibonacci number, * using the recursive definition and dynamic programming *
- Parameters
-
n | the nth Fibonacci number to be computed * (starting the sequence at index 0) * |
fibArr | an initialize array, recording * Fibonacci numbers already computed * |
- Precondition
- 0 <= n <= 1 + length of fibArr array *
- Returns
- the nth Fibonacci number *
◆ main()
main procedure controls computation, timing, and printing *