This counts as one Problem.
Please plot n, vs T(n), Q(n), X(n), for the following
functions, by using a C++ program to produce comma separated values and
the exporting this file into a spreadsheet program to produce a plot.
Always round off the arguments to integers.
- T(n)= T(n/2) + n, T(0)=0
- Q(n) = Q(n-1) + 2n , Q(0) =0
- R(n) = 2*R(n-1)+1, R(0)=0
- X(n) = 3*X(n/2)+1, X(0) =0
int main(void)
{
int n;
for (n = 10; n <=1000; n=n+10)
cout << n<<","<< T(n) <<","<< Q(n) << "," << X(n) << "\n";
exit(1);
}
- Write the first 15 values of R and guess what function it is. (R(n) was not included in the main program above why?)
- Solve the Recurrence Relation P(n) = P(n-1) + 2, P(4) = 4 (use telescoping)