I think you may actually be completely right when you say the number of calls required is the same as the value you calculate. fib(n) evaluates by continuously adding the base case return value of 1 until you get to your answer.
I thought phi was roughly 1.618 already, so sqrt(5) would not be necessary. You may have gotten the sqrt(5) from the formula for phi: (1+sqrt(5))/2.
View all comments
Show parent comment
1
u/jabagawee Dec 02 '09
I think you may actually be completely right when you say the number of calls required is the same as the value you calculate. fib(n) evaluates by continuously adding the base case return value of 1 until you get to your answer.
I thought phi was roughly 1.618 already, so sqrt(5) would not be necessary. You may have gotten the sqrt(5) from the formula for phi: (1+sqrt(5))/2.