Have you tried an iterative approach vs a recursive one?
Your code doesn't follow the equations:
f(1)=2
else if(n==1){
return 1;
Type: Posts; User: Norm
Have you tried an iterative approach vs a recursive one?
Your code doesn't follow the equations:
f(1)=2
else if(n==1){
return 1;
Your algorithm must be doing a lot of recursive calling.
Where did you get the code? Did it give an expression or description of the number of calls it makes.
Have you waited long enough for the program to finish?