Professional Documents
Culture Documents
Assignment Recursion
Assignment Recursion
Fibonacci sequence
Requirements:
3. Write the iterative program in C# to calculate a specific term in that sequence. Use
values of 0 and 1 as starting values.
4. Write the recursive program in C# to calculate a specific term in that sequence. Use
values of 0 and 1 as base cases.
6. Find how many calls = recursion depth are for different inputs;
examples: n = 5, n = 6, n = 7, n = 10, n = 15, n = 20, n = 45
7. Test both algorithms for the above inputs; Record the code execution time for n =7 and
n = 45 for both algorithms. Describe which algorithm do you think is more efficient.
8. Search for additional information regarding this sequence (at least 4 examples).
(Example: Fibonacci sequence in nature).