摘要:
#include using namespace std; //计算fibonacci数 //方法一:二分递归法,时间复杂度为O(2^n),额外空间复杂度为常数 int RecursiveFibonacci(int n) { return (n < 2) ? n : RecursiveFibonacci(n - 1)+RecursiveFibonacci(n-2); } //方法... 阅读全文
posted @ 2017-12-06 18:17
P_langen
阅读(516)
评论(0)
推荐(0)
摘要:
#include using namespace std; //数组求和 //方法一:时间复杂度为O(n),额外空间为(n) int ArraySum(int arr[],int n) { int sum = 0; for (int i = 0; i > 1; return ArraySum(arr, low, mid) + ArraySum(arr, m... 阅读全文
posted @ 2017-12-06 16:53
P_langen
阅读(8806)
评论(0)
推荐(1)
浙公网安备 33010602011771号