递归算法及经典递归例子代码实现

2019-12-30 11:55:41于丽

递归算法,经典递归

//斐波那契
long Fib(int n)
{
 if (n == 0) 
  return 0;
 if (n == 1) 
  return 1;
 if (n > 1) 
  return Fib(n-1) + Fib(n-2);
}