CS209 lab7


http://www.maths.nuigalway.ie/~gettrick/teach/cs209/l7.html




  1. Write two separate programs in C to calculate the nth Fibonacci Number (see, for example http://en.wikipedia.org/wiki/Fibonacci_number). The first program should use iteration and the second recursion (the recursive program must use "top down" recursion, i.e. the recursive function f(n) will call f(n-1) and f(n-2)).
  2. Test both your programs on calculating the 10th, 20th, 30th, 40th etc. Fibonacci number, until the recursive program slows down noticeably.
  3. State the first value of n for which your recursive program takes more than 10 seconds to complete.

© NUI, Galway