1.Easy
Which complexity class grows fastest for large n?
- AO(n²)
- BO(n³)
- CO(2ⁿ)
- DO(n log n)
2.Easy
Which sorting algorithm repeatedly swaps adjacent elements that are in the wrong order?
- AMerge sort
- BHeap sort
- CBubble sort
- DQuicksort
3.Easy
Which design strategy does merge sort use?
- ADivide and conquer
- BBrute force
- CDynamic programming
- DGreedy choice
4.Medium
What is the time complexity of: for i = 1 to n: for j = 1 to i: do O(1) work?
- AO(n)
- BO(n²)
- CO(n³)
- DO(n log n)
5.Medium
What does the recurrence T(n) = 2T(n/2) + O(1) solve to?
- AO(n)
- BO(log n)
- CO(n²)
- DO(n log n)
6.Medium
A greedy algorithm:
- AUses only recursion
- BTries every possible solution
- CAlways gives the optimal solution
- DMakes the locally best choice at each step
7.Hard
For which knapsack variant does the greedy rule "take items in order of value per weight" always give an optimal answer?
- AThe fractional knapsack, where items may be split
- BBoth variants
- CThe 0/1 knapsack, where items must always be taken whole
- DNeither variant
8.Hard
Why does any comparison-based search in a sorted array need Ω(log n) comparisons in the worst case?
- AA decision tree with n possible outcomes must have depth at least log₂ n
- BEvery element must be compared at least once
- CBinary search is the only possible algorithm, and it needs log₂ n comparisons
- DComparisons take logarithmic time each
Answer key
- 1. C · O(2ⁿ)
- 2. C · Bubble sort
- 3. A · Divide and conquer
- 4. B · O(n²)
- 5. A · O(n)
- 6. D · Makes the locally best choice at each step
- 7. A · The fractional knapsack, where items may be split
- 8. A · A decision tree with n possible outcomes must have depth at least log₂ n
Full step-by-step solutions: practise this topic on examproblems.com.