#include //#include #include #include #include #include #include using namespace std; int *a; int recursion(int* a, int num, int final, int sum) { if(num==final) return sum; else { sum += a[num]; cout<>thefile; babyfile.open ("thefile.txt"); if(babyfile.fail()) { cout<> cout<> a[m]; //cout << a[m] << endl; } //Close the file stream in.close(); /* here goes code to read n numbers into a, probably from a file Make sure to allocate space to a */ // the next part is the loop you are supposed to replace by recursion. //finding the sum of the whole thing. //sum = 0; gettimeofday(&start, NULL); for (int i = 0; i < n; i ++) sum += a[i]; // This is the end of the loop. cout <<"Here is the sum: "<< sum << endl; gettimeofday(&end, NULL); //find out what the time is seconds = end.tv_sec - start.tv_sec; useconds = end.tv_usec - start.tv_usec; mtime = ((seconds) * 1000000 + useconds) + 0.5; printf("Elapsed time for the for loop: %ld microseconds\n", mtime); gettimeofday(&start, NULL); cout<