1.Easy
What is the worst-case time complexity of merge sort?
- AO(n)
- BO(n²)
- CO(log n)
- DO(n log n)
2.Easy
Which sorting algorithm chooses a pivot and partitions the array into smaller and larger elements?
- AQuicksort
- BBubble sort
- CInsertion sort
- DMerge sort
3.Easy
What is the time complexity of binary search on a sorted array?
- AO(n)
- BO(1)
- CO(log n)
- DO(n log n)
4.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(mn)
- BO(m + n)
- CO(2m+n)
- DO(mn log n)
5.Medium
What is the time complexity of multiplying two n × n matrices with the standard triple loop?
- AO(n³)
- BO(n)
- CO(n²)
- DO(n² log n)
6.Medium
Why is the base of a logarithm usually left out in Big O, as in O(log n)?
- AAll logarithms in computer science have base 10, so it is implied
- BLogarithms are always rounded to integers
- CLogarithms with different bases differ only by a constant factor
- DThe base only matters for small n
7.Hard
Using the master theorem, T(n) = 8T(n/2) + O(n²) solves to:
- AΘ(n log n)
- BΘ(n²)
- CΘ(n³)
- DΘ(n² log n)
8.Hard
The halting problem shows that:
- ALoops should be avoided
- BNo algorithm can decide for every program and input whether it halts
- CEvery program eventually halts
- DSome programs run faster on faster computers, so halting depends on hardware
Answer key
- 1. D · O(n log n)
- 2. A · Quicksort
- 3. C · O(log n)
- 4. A · O(mn)
- 5. A · O(n³)
- 6. C · Logarithms with different bases differ only by a constant factor
- 7. C · Θ(n³)
- 8. B · No algorithm can decide for every program and input whether it halts
Full step-by-step solutions: practise this topic on examproblems.com.