For finding Fibonacci numbers recursively the relation is f(n)=f(n-1)+f(n-2). How many times is f(n-i) called (in terms of n and i) for recursive function of f(n) ?
I understand that while tracing the recursive calls a binary tree is made. However there does not appear to be any fixed pattern for determining number of recursive calls to f(n-i).Any advice ?
For example, in finding f(5),
f(5)=f(4)+f(3)
f(5)=f(3)+f(2)+f(2)+f(1)
f(5)=f(2)+f(1)+f(1)+f(0)+f(1)+f(0)+f(1)
f(5)=f(1)+f(0)+f(1)+f(1)+f(0)+f(1)+f(0)+f(1)
Here number of calls to f(5)-1,f(4)-1,f(3)-2,f(2)-3,f(1)-5,f(0)-3.
Thanks.