1.Easy
What is O(2ⁿ) growth called?
- ALogarithmic
- BPolynomial
- CExponential
- DLinear
2.Easy
Which notation describes an upper bound on growth?
- ABig O
- BBig Omega
- CBig Theta
- DLittle omega
3.Easy
What is the time complexity of linear search in an unsorted array of n elements (worst case)?
- AO(log n)
- BO(1)
- CO(n²)
- DO(n)
4.Medium
How much stack space does a simple recursive factorial function fact(n) = n × fact(n − 1) use?
- AO(n²)
- BO(log n)
- CO(1)
- DO(n)
5.Medium
With coins of 1, 3 and 4 and an amount of 6, how many coins does the greedy "largest coin first" method use, compared to the optimum?
- AGreedy uses 3 coins; the optimum is 3
- BGreedy uses 2 coins; the optimum is 2
- CGreedy uses 3 coins; the optimum is 2
- DGreedy uses 4 coins; the optimum is 3
6.Medium
What does the recurrence T(n) = 2T(n − 1) + O(1) solve to?
- AO(2ⁿ)
- BO(n²)
- CO(n)
- DO(n log n)
7.Hard
To show that a new problem X is NP-hard, what must you do?
- AReduce X to a known NP-hard problem in polynomial time
- BReduce a known NP-hard problem to X in polynomial time
- CShow that X can be verified in polynomial time
- DShow that X has no polynomial algorithm for small inputs
8.Hard
Which technique gives an expected O(n log n) running time for quicksort on any input?
- ASorting the input before running quicksort
- BUsing recursion only on the left side
- CAlways choosing the first element
- DChoosing the pivot uniformly at random
Answer key
- 1. C · Exponential
- 2. A · Big O
- 3. D · O(n)
- 4. D · O(n)
- 5. C · Greedy uses 3 coins; the optimum is 2
- 6. A · O(2ⁿ)
- 7. B · Reduce a known NP-hard problem to X in polynomial time
- 8. D · Choosing the pivot uniformly at random
Full step-by-step solutions: practise this topic on examproblems.com.