What is the runtime of the following code segments? Prove that your answer is correct.
1.
void foo(int* array, int size)
{
int sum = 0;
int product = 1;
for (int i=0; i < size;="">
sum += arrray[i];
}
for (int i =0; i < size;="">
product *= array[i];
cout < sum="">< "="" ,"=""><>
2.
void printPairs ( int * array, int size) {
for (int i=0; i
for (int j=0; j < size;="">
cout < array[i]="">< "="" +="" "=""><>
3.
void reverse(int * array, int size) {
int other = size - i-1;
int temp = array[i];
array[i] = array [other];
array[other] = temp;
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here