1.Easy
How much extra memory does a standard array-based merge sort use?
- AO(log n)
- BO(n)
- CO(n²)
- DO(1)
2.Easy
What is log₂ 1024?
- A32
- B512
- C12
- D10
3.Easy
An O(n²) algorithm takes 1 second for n = 1000. About how long does it take for n = 2000?
- A4 seconds
- B2 seconds
- C8 seconds
- D1 second
4.Medium
What does amortised analysis measure?
- AThe average cost per operation over a worst-case sequence of operations
- BThe expected cost over random inputs
- CThe cost of the single most expensive operation anywhere in the sequence
- DThe cost of an algorithm on the best input
5.Medium
Quicksort always uses the first element as pivot. On which input does it show its worst-case behaviour?
- AAn array that is already sorted
- BAn array in random order
- CAn array of length 2
- DAn array whose elements are all different
6.Medium
What is the time complexity of the standard dynamic programming algorithm for the longest common subsequence of strings of lengths m and n?
- AO(2m+n)
- BO(mn log n)
- CO(m + n)
- DO(mn)
7.Hard
What does the recurrence T(n) = 2T(n/2) + n log n solve to?
- AΘ(n)
- BΘ(n log n)
- CΘ(n²)
- DΘ(n log² n)
8.Hard
Why is the average lookup in a hash table O(1) but the worst case O(n)?
- AKeys must be sorted first
- BMany keys may collide into the same bucket
- CHash functions are slow
- DArrays have O(n) access
Answer key
- 1. B · O(n)
- 2. D · 10
- 3. A · 4 seconds
- 4. A · The average cost per operation over a worst-case sequence of operations
- 5. A · An array that is already sorted
- 6. D · O(mn)
- 7. D · Θ(n log² n)
- 8. B · Many keys may collide into the same bucket
Full step-by-step solutions: practise this topic on examproblems.com.