Sign in

Libre University uses your GitHub account. Signing in is only needed to sit a final test, so the score is kept on your profile.

How cost grows

1.[2p]

What exactly does f(n)=O(g(n)) assert?

Correct
The answer is: There exist $c > 0$ and $n_0$ with $f(n) \le c\,g(n)$ for every $n \ge n_0$
The answer is: There exist $c > 0$ and $n_0$ with $f(n) \le c\,g(n)$ for every $n \ge n_0$
The answer is: There exist $c > 0$ and $n_0$ with $f(n) \le c\,g(n)$ for every $n \ge n_0$

2.[2p]

Using the bound 5n0.5n2 and 100n2, the proof that 3n2+5n+100=O(n2) gives a witness constant c. What is c?

CorrectNot quite: 4.5

3.[2p]

The statement "quicksort is at least O(nlogn)" is a well-formed claim.

The answer is: False
Correct

4.[3p]

Which of these are true of f(n)=6n2+40n?

Select all that apply

Correct
Correct
Correct
The answer is: $f(n) = O(n^2)$, $f(n) = \Theta(n^2)$, $f(n) = O(n^3)$

5.[2p]

A cubic algorithm takes 1.0 second on n=1000. How many seconds does it take on n=5000?

CorrectNot quite: 125

6.[2p]

A loop runs n times, and its body halves a counter starting at n until the counter reaches 1. The total cost is

Correct
The answer is: $\Theta(n \log n)$
The answer is: $\Theta(n \log n)$
The answer is: $\Theta(n \log n)$

7.[2p]

Why does O(logn) need no logarithm base?

Correct
The answer is: Changing base multiplies by a constant, and constants are discarded
The answer is: Changing base multiplies by a constant, and constants are discarded
The answer is: Changing base multiplies by a constant, and constants are discarded

8.[3p]

Put these costs in order from slowest-growing to fastest-growing.

  1. nlog2n

  2. n

  3. 2n

  4. n2

  5. log2n

Show the answer

b, e, d, a, c

9.[2p]

A "galactic algorithm" such as the current record for matrix multiplication is one that

Correct
The answer is: has a better exponent but constants so large it never wins at any feasible input size
The answer is: has a better exponent but constants so large it never wins at any feasible input size
The answer is: has a better exponent but constants so large it never wins at any feasible input size