1.Easy
What are the three steps of a divide-and-conquer algorithm?
- ADivide, conquer, combine
- BRead, compute, write
- CGuess, check, repeat
- DSort, search, return
2.Easy
Space complexity measures:
- AThe disk space of the program file once it is compiled
- BThe physical size of the computer
- CThe amount of memory an algorithm needs as input grows
- DThe number of lines of code
3.Easy
An algorithm's running time is O(n). What is this growth called?
- AConstant
- BLogarithmic
- CQuadratic
- DLinear
4.Medium
Which algorithm finds the shortest paths from one source in a graph with non-negative edge weights?
- ABellman–Ford is required in all cases
- BKruskal's algorithm
- CDijkstra's algorithm
- DDepth-first search
5.Medium
What does the recurrence T(n) = T(n/2) + O(1) solve to?
- AO(n log n)
- BO(n)
- CO(1)
- DO(log n)
6.Medium
In the activity selection problem, which greedy rule always gives a maximum number of non-overlapping activities?
- APick the activity that finishes earliest, then repeat with the compatible ones
- BPick the shortest activity first
- CPick the activity that starts earliest
- DPick the activity with the fewest overlaps first, then repeat with the compatible ones
7.Hard
How is the travelling salesman problem classified?
- AThe decision version is in P but the optimisation version is NP-complete
- BThe decision version is NP-complete and the optimisation version is NP-hard
- CIt is in P because Dijkstra's algorithm solves it by visiting every city once
- DIt is undecidable
8.Hard
What does the recurrence T(n) = 2T(n/2) + n log n solve to?
- AΘ(n)
- BΘ(n log² n)
- CΘ(n²)
- DΘ(n log n)
Answer key
- 1. A · Divide, conquer, combine
- 2. C · The amount of memory an algorithm needs as input grows
- 3. D · Linear
- 4. C · Dijkstra's algorithm
- 5. D · O(log n)
- 6. A · Pick the activity that finishes earliest, then repeat with the compatible ones
- 7. B · The decision version is NP-complete and the optimisation version is NP-hard
- 8. B · Θ(n log² n)
Full step-by-step solutions: practise this topic on examproblems.com.