1.Easy
What are the three steps of a divide-and-conquer algorithm?
- ADivide, conquer, combine
- BSort, search, return
- CRead, compute, write
- DGuess, check, repeat
2.Easy
What is log₂ 1024?
- A10
- B32
- C12
- D512
3.Easy
Which of these grows slowest as n becomes large?
- AO(n²)
- BO(log n)
- CO(n)
- DO(n log n)
4.Medium
Why do many library sorting routines switch to insertion sort for very small subarrays?
- ARecursive algorithms cannot handle arrays below 10 elements
- BInsertion sort is O(n log n) in the worst case
- 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
5.Medium
Which statement about a recursive function without a reachable base case is correct?
- AThe compiler always turns it into a loop that ends safely
- BIt keeps calling itself until the call stack overflows
- CIt runs in O(1) time
- DIt returns 0 automatically
6.Medium
What does the recurrence T(n) = 2T(n − 1) + O(1) solve to?
- AO(n log n)
- BO(2ⁿ)
- CO(n²)
- DO(n)
7.Hard
What does the recurrence T(n) = 2T(n/2) + n log n solve to?
- AΘ(n²)
- BΘ(n log n)
- CΘ(n log² n)
- DΘ(n)
8.Hard
What is the time complexity of: for i = 1 to n: for (j = i; j ≤ n; j = j + i) do O(1) work?
- AO(n)
- BO(n √n)
- CO(n log n)
- DO(n²)
Answer key
- 1. A · Divide, conquer, combine
- 2. A · 10
- 3. B · O(log n)
- 4. C · Insertion sort has little overhead and is fast on small or nearly sorted inputs
- 5. B · It keeps calling itself until the call stack overflows
- 6. B · O(2ⁿ)
- 7. C · Θ(n log² n)
- 8. C · O(n log n)
Full step-by-step solutions: practise this topic on examproblems.com.