1.Easy
What does it mean if an operation runs in O(1) time?
- AIt can only be run once
- BIts running time does not grow with the input size
- CIt always takes exactly one second
- DIt processes exactly one element per second of running time
2.Easy
What is memoisation?
- AFreeing memory after a function returns
- BConverting recursion into an equivalent loop automatically so no call stack is needed
- CWriting comments next to each line of code
- DStoring the results of function calls so repeated calls are answered from memory
3.Easy
A problem is usually called tractable if:
- AIt can be solved in polynomial time
- BIt can only be solved by trying every possibility
- CIt has no solution
- DIt can be solved in constant time
4.Medium
What is the time complexity of multiplying two n × n matrices with the standard triple loop?
- AO(n)
- BO(n³)
- CO(n² log n)
- DO(n²)
5.Medium
Which sorting algorithm is stable?
- ASelection sort (typical version)
- BHeap sort
- CQuicksort (typical in-place version)
- DMerge sort
6.Medium
A function runs one loop of n iterations and then, separately, another loop of n iterations. What is its time complexity?
- AO(n)
- BO(2ⁿ)
- CO(n²)
- DO(log n)
7.Hard
Which statement about P and NP is correct?
- ANP means "not polynomial"
- BNP problems cannot be verified quickly
- CIt has been proven that P ≠ NP
- DEvery problem in P is also in NP
8.Hard
Strassen's algorithm multiplies matrices using 7 instead of 8 recursive multiplications of half-size blocks. What is its running time?
- AΘ(n² log n)
- BΘ(nlog₂ 7), about n2.81
- CΘ(n2)
- DΘ(n³)
Answer key
- 1. B · Its running time does not grow with the input size
- 2. D · Storing the results of function calls so repeated calls are answered from memory
- 3. A · It can be solved in polynomial time
- 4. B · O(n³)
- 5. D · Merge sort
- 6. A · O(n)
- 7. D · Every problem in P is also in NP
- 8. B · Θ(nlog₂ 7), about n2.81
Full step-by-step solutions: practise this topic on examproblems.com.