/5031-hw1

First HW problem for CPSC 5031

Primary LanguageC#MIT LicenseMIT

Assignment

In class, we discussed three ways to compute the nth term of the Fibonacci sequence:

  • Classic recursive
  • Iterative
  • Recursive with accumulators
  • Constant Write a program in the language of your choice that implements Fibonacci in each of the first three techniques and counts the number of addition operations when called.

Submission

Turn in your homework via Canvas and include the source code and raw output of your program. Fill out the following table and submit it as well:

Number of addition operations in…

fib(n) Classic Recursive Iterative Recursive w/ Accum
n=3
n=10
n=20