1.Easy
What is the running time of counting sort for n integers in the range 0 to k?
- AO(n + k)
- BO(n²)
- CO(k log n)
- DO(n log n)
2.Easy
What are the three steps of a divide-and-conquer algorithm?
- ADivide, conquer, combine
- BSort, search, return
- CRead, compute, write
- DGuess, check, repeat
3.Easy
What is O(2ⁿ) growth called?
- AExponential
- BPolynomial
- CLogarithmic
- DLinear
4.Medium
What is the amortised time complexity of appending to a dynamic array that doubles its capacity when full?
- AO(n²)
- BO(n)
- CO(log n)
- DO(1)
5.Medium
The lower bound for comparison-based sorting in the worst case is:
- AΩ(n)
- BΩ(n²)
- CΩ(n log n)
- DΩ(log n)
6.Medium
What does the recurrence T(n) = T(n/2) + O(1) solve to?
- AO(n)
- BO(1)
- CO(n log n)
- DO(log n)
7.Hard
Which technique gives an expected O(n log n) running time for quicksort on any input?
- AAlways choosing the first element
- BChoosing the pivot uniformly at random
- CSorting the input before running quicksort
- DUsing recursion only on the left side
8.Hard
Why can Dijkstra's algorithm give wrong results when some edge weights are negative?
- AA vertex is finalised when extracted, but a later negative edge could still give it a shorter path
- BIt only works on undirected graphs
- CNegative numbers cannot be stored in a priority queue
- DIt goes into an infinite loop on every negative edge
Answer key
- 1. A · O(n + k)
- 2. A · Divide, conquer, combine
- 3. A · Exponential
- 4. D · O(1)
- 5. C · Ω(n log n)
- 6. D · O(log n)
- 7. B · Choosing the pivot uniformly at random
- 8. A · A vertex is finalised when extracted, but a later negative edge could still give it a shorter path
Full step-by-step solutions: practise this topic on examproblems.com.