1.Easy
What is the best-case time complexity of insertion sort, on an already sorted array?
- AO(n²)
- BO(n)
- CO(n log n)
- DO(1)
2.Easy
Which of these grows slowest as n becomes large?
- AO(n²)
- BO(log n)
- CO(n log n)
- DO(n)
3.Easy
An algorithm's running time is O(n). What is this growth called?
- AQuadratic
- BLogarithmic
- CLinear
- DConstant
4.Medium
Why do many library sorting routines switch to insertion sort for very small subarrays?
- AInsertion sort is O(n log n) in the worst case
- BRecursive algorithms cannot handle arrays below 10 elements
- 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
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
Which sorting algorithm is stable?
- ASelection sort (typical version)
- BMerge sort
- CHeap sort
- DQuicksort (typical in-place version)
7.Hard
Why does binary search not give O(log n) time on a singly linked list?
- ABinary search needs at least twice the memory
- BReaching the middle element takes O(n) steps, since there is no direct index access
- CComparisons on linked list nodes are slower
- DLinked lists cannot be sorted
8.Hard
The halting problem shows that:
- ALoops should be avoided
- BNo algorithm can decide for every program and input whether it halts
- CSome programs run faster on faster computers, so halting depends on hardware
- DEvery program eventually halts
Answer key
- 1. B · O(n)
- 2. B · O(log n)
- 3. C · Linear
- 4. C · Insertion sort has little overhead and is fast on small or nearly sorted inputs
- 5. A · O(n³)
- 6. B · Merge sort
- 7. B · Reaching the middle element takes O(n) steps, since there is no direct index access
- 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.