Author:
Harvey Maxwell

Buy here:

http://www.devrygenius.com/product/ecet-370-week-4-quiz

1. (TCO 4) Which of the following functions grows at a slower rate than the rest?

2. (TCO 4) Algorithms can be described using ____

3. (TCO 4) The running time of an algorithm is _____.

4. (TCO 4) The following function returns the _____ of the array elements.

int mystery(int a[], int n)

{

int x=a[0];

for (int i=1; i

if (x < a[i])="" x="">

return x;

5. (TCO 5) Consider the recursive function below:

int RecFunction(int n){ if (n==0) return 0; else return RecFunction(n-1) + n;}

6. (TCO 5) Consider the function below:

long x(int n)

{

if (n == 1) return 1;

else return n*x(n-1);

}

What will be displayed by the cout statement cout < x(5)="">< endl;="">

7. (TCO 5) The bubble sort algorithm uses a(n) _____ number of steps.

8. (TCO 5) A method that performs very well in practice, even though its worst-case running time is quadratic, is __________.

9. (TCO 4) The running time of an algorithm to find the maximum of a collection of n numbers stored in an array is __________

10. (TCO 5) Consider the recursive function below:

long myFunction(int x)

{

if (x==0 || x==1) return x;

else return myFunction(x-1) + myFunction(x-2);

}

What will be displayed by System.out.println(myFunction(3));?

11. (TCO 5) The running time of merge sort is _________

Tutorial