1.Easy
What is the best-case time complexity of insertion sort, on an already sorted array?
- AO(n)
- BO(n²)
- CO(n log n)
- DO(1)
2.Easy
Which notation describes an upper bound on growth?
- ABig Omega
- BBig O
- CLittle omega
- DBig Theta
3.Easy
An algorithm's running time is O(n). What is this growth called?
- ALogarithmic
- BLinear
- CConstant
- DQuadratic
4.Medium
Dynamic programming is useful when a problem has:
- AA single loop
- BNo subproblems at all, so it can be solved in one step
- COnly random inputs
- DOverlapping subproblems and optimal substructure
5.Medium
You sort an array of n elements once and then answer k membership queries with binary search. What is the total cost?
- AO(n log n + k log n)
- BO(k n log n)
- CO(nk)
- DO(n + k)
6.Medium
What does amortised analysis measure?
- AThe expected cost over random inputs
- BThe cost of an algorithm on the best input
- CThe average cost per operation over a worst-case sequence of operations
- DThe cost of the single most expensive operation anywhere in the sequence
7.Hard
Is 22n in O(2ⁿ)?
- ANo, because 22n = 4ⁿ and 4ⁿ / 2ⁿ = 2ⁿ grows without bound
- BYes, because both are exponential
- CNo, because 22n grows more slowly than 2ⁿ
- DYes, because constant factors in the exponent are always ignored in Big O
8.Hard
Which bound is correct for log(n!)?
- AΘ(n)
- BΘ(n log n)
- CΘ(log n)
- DΘ(n²)
Answer key
- 1. A · O(n)
- 2. B · Big O
- 3. B · Linear
- 4. D · Overlapping subproblems and optimal substructure
- 5. A · O(n log n + k log n)
- 6. C · The average cost per operation over a worst-case sequence of operations
- 7. A · No, because 22n = 4ⁿ and 4ⁿ / 2ⁿ = 2ⁿ grows without bound
- 8. B · Θ(n log n)
Full step-by-step solutions: practise this topic on examproblems.com.