Which of these expressions could replace a call to this function?
Consider the recursive function,
```
int rec(int n)
{
if (1 ==n )
return 1;
else
return rec(n-1) + 2*n - 1;
}
```
a) n2 - 1
b) n2 + 1
c) n2
d) (n + 1)2
e) (n - 1)2
c) n2
If you look at the carefully, you may see that it this sums successive odd numbers. The sum of k odd numbers sums to k2. Otherwise, you could execute this for a few values of argument, n, say 1, 2, 3, and 4, and unroll the recursion. You will find that rec(n) sums successive odd numbers.
You might also like to view...
When a relationship is defined to enforce referential integrity and Cascade ________ Related Fields, Access will automatically change the data through all related tables when a revision is made to the data in the table that contains the primary key
A) Delete B) Update C) Remove D) Change
The capability to bind data members with operations in a single unit is referred to as encapsulation.
Answer the following statement true (T) or false (F)
Before you begin to clean the inside of a PC case, it is important to take precaution and complete what critical first step?
discharge all static electricity move PC to stable desktop ground the PC case disconnect the power cord
The following permissions are necessary in the Android Manifest file to use which type of storage? ?
A. internal B. external C. indexed D. volatile