1.Easy
Which notation describes a lower bound on growth?
- Ao (little o)
- BO (Big O)
- CΘ (Big Theta)
- DΩ (Big Omega)
2.Easy
What is the time complexity of binary search on a sorted array?
- AO(n log n)
- BO(log n)
- CO(n)
- DO(1)
3.Easy
Which notation describes an upper bound on growth?
- ALittle omega
- BBig O
- CBig Omega
- DBig Theta
4.Medium
Quicksort always uses the first element as pivot. On which input does it show its worst-case behaviour?
- AAn array in random order
- BAn array whose elements are all different
- CAn array that is already sorted
- DAn array of length 2
5.Medium
Why do many library sorting routines switch to insertion sort for very small subarrays?
- AInsertion sort is O(n log n) in the worst case
- BRecursive algorithms cannot handle arrays below 10 elements
- CInsertion sort has little overhead and is fast on small or nearly sorted inputs
- DInsertion sort uses less memory than any other sorting algorithm on large inputs
6.Medium
Why is the base of a logarithm usually left out in Big O, as in O(log n)?
- ALogarithms with different bases differ only by a constant factor
- BLogarithms are always rounded to integers
- CAll logarithms in computer science have base 10, so it is implied
- DThe base only matters for small n
7.Hard
The halting problem shows that:
- ANo algorithm can decide for every program and input whether it halts
- BEvery program eventually halts
- CSome programs run faster on faster computers, so halting depends on hardware
- DLoops should be avoided
8.Hard
To show that a new problem X is NP-hard, what must you do?
- AShow that X can be verified in polynomial time
- BShow that X has no polynomial algorithm for small inputs
- CReduce a known NP-hard problem to X in polynomial time
- DReduce X to a known NP-hard problem in polynomial time
Answer key
- 1. D · Ω (Big Omega)
- 2. B · O(log n)
- 3. B · Big O
- 4. C · An array that is already sorted
- 5. C · Insertion sort has little overhead and is fast on small or nearly sorted inputs
- 6. A · Logarithms with different bases differ only by a constant factor
- 7. A · No algorithm can decide for every program and input whether it halts
- 8. C · Reduce a known NP-hard problem to X in polynomial time
Full step-by-step solutions: practise this topic on examproblems.com.