1.Easy
What is the base case of a recursive function?
- AThe first line of the function
- BA case that is answered directly without making another recursive call
- CThe call that uses the most memory
- DThe case with the largest input, which is handled before any recursive calls
2.Easy
What is the worst-case time complexity of merge sort?
- AO(n²)
- BO(n log n)
- CO(n)
- DO(log n)
3.Easy
What is the Big O of 3n² + 5n + 2?
- AO(3n²)
- BO(n³)
- CO(5n)
- DO(n²)
4.Medium
What is the time complexity of computing the n-th Fibonacci number with a bottom-up table?
- AO(log n)
- BO(2ⁿ)
- CO(n²)
- DO(n)
5.Medium
In a sorted array, you look for two elements that sum to a target by moving one pointer from each end inwards. What is the time complexity?
- AO(log n)
- BO(n²)
- CO(n log n)
- DO(n)
6.Medium
Why does dynamic programming give no real speed-up for merge sort?
- AIts subproblems do not overlap, so there is nothing to reuse
- BDynamic programming only works on graph problems, not on arrays
- CMerge sort is already O(n)
- DMerge sort has no recursive structure
7.Hard
What did the Cook–Levin theorem establish?
- AEvery NP problem can be solved in exponential time
- BP is not equal to NP
- CThe Boolean satisfiability problem (SAT) is NP-complete
- DThe halting problem is undecidable
8.Hard
Why does binary search not give O(log n) time on a singly linked list?
- AReaching the middle element takes O(n) steps, since there is no direct index access
- BComparisons on linked list nodes are slower
- CLinked lists cannot be sorted
- DBinary search needs at least twice the memory
Answer key
- 1. B · A case that is answered directly without making another recursive call
- 2. B · O(n log n)
- 3. D · O(n²)
- 4. D · O(n)
- 5. D · O(n)
- 6. A · Its subproblems do not overlap, so there is nothing to reuse
- 7. C · The Boolean satisfiability problem (SAT) is NP-complete
- 8. A · Reaching the middle element takes O(n) steps, since there is no direct index access
Full step-by-step solutions: practise this topic on examproblems.com.