1.Easy
Which notation describes an upper bound on growth?
- ABig Theta
- BLittle omega
- CBig Omega
- DBig O
2.Easy
What is the best-case time complexity of insertion sort, on an already sorted array?
- AO(n log n)
- BO(n²)
- CO(1)
- DO(n)
3.Easy
What is recursion?
- AA loop that never ends
- BA type of data structure
- CA function that calls itself on smaller inputs
- DA sorting method
4.Medium
What is the time complexity of: for i = 1 to n: for j = 1 to i: do O(1) work?
- AO(n log n)
- BO(n)
- CO(n³)
- DO(n²)
5.Medium
A greedy algorithm:
- AMakes the locally best choice at each step
- BTries every possible solution
- CUses only recursion
- DAlways gives the optimal solution
6.Medium
Quicksort always uses the first element as pivot. On which input does it show its worst-case behaviour?
- AAn array whose elements are all different
- BAn array in random order
- CAn array that is already sorted
- DAn array of length 2
7.Hard
Insertion sort runs in O(n) on sorted input. Does this contradict the Ω(n log n) lower bound for comparison sorting?
- ANo, the lower bound applies to the worst case over all inputs, not to every input
- BYes, the lower bound is therefore wrong
- CNo, because insertion sort is not a comparison sort
- DYes, but only for arrays shorter than 100
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 goes into an infinite loop on every negative edge
- CNegative numbers cannot be stored in a priority queue
- DIt only works on undirected graphs
Answer key
- 1. D · Big O
- 2. D · O(n)
- 3. C · A function that calls itself on smaller inputs
- 4. D · O(n²)
- 5. A · Makes the locally best choice at each step
- 6. C · An array that is already sorted
- 7. A · No, the lower bound applies to the worst case over all inputs, not to every input
- 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.