1.Easy
Which sorting algorithm repeatedly swaps adjacent elements that are in the wrong order?
- AQuicksort
- BMerge sort
- CHeap sort
- DBubble sort
2.Easy
What is the worst-case time complexity of insertion sort?
- AO(n log n)
- BO(log n)
- CO(n)
- DO(n²)
3.Easy
What is the time complexity of linear search in an unsorted array of n elements (worst case)?
- AO(1)
- BO(n²)
- CO(log n)
- DO(n)
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
Why is the base of a logarithm usually left out in Big O, as in O(log n)?
- ALogarithms are always rounded to integers
- BAll logarithms in computer science have base 10, so it is implied
- CThe base only matters for small n
- DLogarithms with different bases differ only by a constant factor
6.Medium
What does the recurrence T(n) = 2T(n/2) + O(1) solve to?
- AO(n)
- BO(n²)
- CO(n log n)
- DO(log n)
7.Hard
What is the difference between an undecidable problem and an intractable one?
- AIntractable problems cannot be solved by any algorithm, while undecidable ones only need exponential time
- BBoth mean the problem has no algorithm at all
- CUndecidable problems are in NP, while intractable problems are in P
- DAn undecidable problem has no algorithm for all inputs; an intractable one has one, but it is too slow
8.Hard
Karatsuba multiplication satisfies T(n) = 3T(n/2) + O(n). What does this solve to?
- AΘ(n3)
- BΘ(nlog₂ 3), about n1.585
- CΘ(n²)
- DΘ(n log n)
Answer key
- 1. D · Bubble sort
- 2. D · O(n²)
- 3. D · O(n)
- 4. A · O(n³)
- 5. D · Logarithms with different bases differ only by a constant factor
- 6. A · O(n)
- 7. D · An undecidable problem has no algorithm for all inputs; an intractable one has one, but it is too slow
- 8. B · Θ(nlog₂ 3), about n1.585
Full step-by-step solutions: practise this topic on examproblems.com.