Question: 3-8. Consider the following code fragment in which the variables mandnare assumed to have been declared as integers, and the array a has at least
3-8. Consider the following code fragment in which the variables mandnare assumed to have been declared as integers, and the array a has at least n cells that have been given various integer values. for (m = n-1; m >= 0; --m)if (a[m] < 0) // If a[m] is negative, then changea[m] *= (-1); // its sign by multiplying it by -1 .Let T(n) denote the execution time that will be observed when this code fragment is executed. Which of the following statements best describes T(n) ?
(a)T(n) = An + B for some constants A and B .
(b)A1n + B1T(n) A2n + B2for some constants A1, B1, A2, and B2.
(c)T(n) = An2+ Bn + C for some constants A, B, and C .
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
