1.Easy
What does f(n) = Θ(g(n)) mean?
- Af grows strictly faster than g
- Bf grows strictly slower than g
- Cf is always smaller than g for every n, so g bounds it from above but never from below
- Df grows at the same rate as g, bounded above and below by constant multiples of g
2.Easy
How does selection sort work?
- AIt splits the array in halves and merges them
- BIt repeatedly swaps neighbouring elements that are in the wrong order
- CIt repeatedly finds the minimum of the unsorted part and swaps it to the front
- DIt inserts each element into a growing sorted part by shifting
3.Easy
What is the worst-case time complexity of insertion sort?
- AO(log n)
- BO(n²)
- CO(n)
- DO(n log n)
4.Medium
What does amortised analysis measure?
- AThe expected cost over random inputs
- BThe cost of an algorithm on the best input
- CThe average cost per operation over a worst-case sequence of operations
- DThe cost of the single most expensive operation anywhere in the sequence
5.Medium
How much stack space does a simple recursive factorial function fact(n) = n × fact(n − 1) use?
- AO(n²)
- BO(log n)
- CO(n)
- DO(1)
6.Medium
A greedy algorithm:
- AAlways gives the optimal solution
- BUses only recursion
- CTries every possible solution
- DMakes the locally best choice at each step
7.Hard
Why does any comparison-based search in a sorted array need Ω(log n) comparisons in the worst case?
- ABinary search is the only possible algorithm, and it needs log₂ n comparisons
- BComparisons take logarithmic time each
- CEvery element must be compared at least once
- DA decision tree with n possible outcomes must have depth at least log₂ n
8.Hard
Which algorithm finds a minimum spanning tree by repeatedly adding the cheapest edge that does not form a cycle?
- AKruskal's algorithm
- BDijkstra's algorithm
- CFloyd–Warshall
- DPrim's algorithm starting from one node
Answer key
- 1. D · f grows at the same rate as g, bounded above and below by constant multiples of g
- 2. C · It repeatedly finds the minimum of the unsorted part and swaps it to the front
- 3. B · O(n²)
- 4. C · The average cost per operation over a worst-case sequence of operations
- 5. C · O(n)
- 6. D · Makes the locally best choice at each step
- 7. D · A decision tree with n possible outcomes must have depth at least log₂ n
- 8. A · Kruskal's algorithm
Full step-by-step solutions: practise this topic on examproblems.com.