ECET 370 Week 4 Quiz

ECET 370 Week 4 Quiz

Author: Harvey Maxwell

Buy here:


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 _________

See More
Try a College Course Free

Sophia’s self-paced online courses are a great way to save time and money as you earn credits eligible for transfer to over 2,000 colleges and universities.*

Begin Free Trial
No credit card required

26 Sophia partners guarantee credit transfer.

226 Institutions have accepted or given pre-approval for credit transfer.

* The American Council on Education's College Credit Recommendation Service (ACE Credit®) has evaluated and recommended college credit for 21 of Sophia’s online courses. More than 2,000 colleges and universities consider ACE CREDIT recommendations in determining the applicability to their course and degree programs.