CW 37 - Iterative Fibonacci

DUE

Iterative Fibonacci

Save your work here: .../APCSA2/apcsa-assignments-YourUsername-spring/classwork/02_02_fibIter/

  1. Draw the call stack for fibIter(10, 1, 0) - Submit a txt file with your call stack.

  2. Implement the iterative Fibonacci algorithm (IterativeFibonacci.java):

/*
* Preconditions:
* n is a non-negative integer
* n refers to the nth element in the fib sequequence
* initial f1 value is 1
* initial f2 value is 0
*/
public static int fibIter(int n, int f1, int f2){
  // remember the recursive case calls fibIter once
}