将递归函数改为尾递归,或者是递推函数,求第47, 48, 49, 50, 51,52个Fibonacci数所花费的时间,观察效率是否得到提高。
#include<iostream>
#include<ctime>
using namespace std;
#define N 100
int fibonacci(int n)
{
if (n <= 1) <
将递归函数改为尾递归,或者是递推函数,求第47, 48, 49, 50, 51,52个Fibonacci数所花费的时间,观察效率是否得到提高。
#include<iostream>
#include<ctime>
using namespace std;
#define N 100
int fibonacci(int n)
{
if (n <= 1) <