1.Easy
What does f(n) = Θ(g(n)) mean?
- Af grows strictly slower than g
- Bf grows at the same rate as g, bounded above and below by constant multiples of g
- Cf grows strictly faster than g
- Df is always smaller than g for every n, so g bounds it from above but never from below
2.Easy
A problem is usually called tractable if:
- AIt can only be solved by trying every possibility
- BIt can be solved in polynomial time
- CIt has no solution
- DIt can be solved in constant time
3.Easy
What is the best-case time complexity of insertion sort, on an already sorted array?
- AO(1)
- BO(n log n)
- CO(n²)
- DO(n)
4.Medium
Why does dynamic programming give no real speed-up for merge sort?
- AMerge sort has no recursive structure
- BIts subproblems do not overlap, so there is nothing to reuse
- CMerge sort is already O(n)
- DDynamic programming only works on graph problems, not on arrays
5.Medium
In a sorted array, you look for two elements that sum to a target by moving one pointer from each end inwards. What is the time complexity?
- AO(log n)
- BO(n²)
- CO(n)
- DO(n log n)
6.Medium
A greedy algorithm:
- AUses only recursion
- BMakes the locally best choice at each step
- CTries every possible solution
- DAlways gives the optimal solution
7.Hard
To show that a new problem X is NP-hard, what must you do?
- AReduce X to a known NP-hard problem in polynomial time
- BShow that X can be verified in polynomial time
- CShow that X has no polynomial algorithm for small inputs
- DReduce a known NP-hard problem to X in polynomial time
8.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
Answer key
- 1. B · f grows at the same rate as g, bounded above and below by constant multiples of g
- 2. B · It can be solved in polynomial time
- 3. D · O(n)
- 4. B · Its subproblems do not overlap, so there is nothing to reuse
- 5. C · O(n)
- 6. B · Makes the locally best choice at each step
- 7. D · Reduce a known NP-hard problem to X in polynomial time
- 8. D · An undecidable problem has no algorithm for all inputs; an intractable one has one, but it is too slow
Full step-by-step solutions: practise this topic on examproblems.com.