Back

Question: 2014 Winter Final - 11

Author: Michiel Smid
The Fibonacci numbers are defined as follows: $f_0 = 0$, $f_1 = 1$, and $f_n = f_{n-1} + f_{n-2}$ for $n \geq 2$.
Consider the recursive algorithm $\Fib$, which takes as input an integer $n \geq 0$:

$\mathbf{Algorithm}\ \Fib(n)\mathrm{:}$
$\mathbf{if}\ n = 0\ \mathrm{or}\ n = 1$
$\mathbf{then}\ f = n$
$\mathbf{else}\ f = \Fib(n - 1) + \Fib(n - 2)$
$\mathbf{endif};$
$\mathbf{return}\ f$

For $n \geq 5$, run algorithm $\Fib(n)$ and let $a_n$ be the number of times that $\Fib(4)$ is called.
Which of the following is true?
(a)
for all $n \geq 5$, $a_n = f_{n-2}$
(b)
for all $n \geq 5$, $a_n = f_{n-3}$
(c)
for all $n \geq 5$, $a_n = f_{n-1}$
(d)
for all $n \geq 5$, $a_n = f_n$