1.Easy
A problem is usually called tractable if:
- AIt has no solution
- BIt can only be solved by trying every possibility
- CIt can be solved in constant time
- DIt can be solved in polynomial time
2.Easy
What is a brute-force algorithm?
- AOne that always uses recursion
- BOne that tries all possible candidate solutions
- COne that guesses an answer at random
- DOne that runs on many processors
3.Easy
What does the worst-case running time of an algorithm describe?
- AThe maximum time it takes over all inputs of size n
- BThe time it takes on a slow computer
- CThe time it takes on the smallest input
- DThe expected time it takes on a random input of size n
4.Medium
How many levels does the recursion of merge sort have for an array of n elements?
- AAbout n
- BAbout log₂ n
- CAbout n / 2
- DAbout √n
5.Medium
Dynamic programming is useful when a problem has:
- ANo subproblems at all, so it can be solved in one step
- BOverlapping subproblems and optimal substructure
- COnly random inputs
- DA single loop
6.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 log n)
- DO(n³)
7.Hard
How does the Bellman–Ford algorithm detect a negative-weight cycle reachable from the source?
- AAfter V − 1 rounds, it checks whether any edge can still be relaxed
- BIt checks whether any edge has a negative weight
- CIt counts the cycles with depth-first search
- DIt runs Dijkstra's algorithm twice and compares the two distance results
8.Hard
Why can Dijkstra's algorithm give wrong results when some edge weights are negative?
- AA vertex is finalised when extracted, but a later negative edge could still give it a shorter path
- BNegative numbers cannot be stored in a priority queue
- CIt only works on undirected graphs
- DIt goes into an infinite loop on every negative edge
Answer key
- 1. D · It can be solved in polynomial time
- 2. B · One that tries all possible candidate solutions
- 3. A · The maximum time it takes over all inputs of size n
- 4. B · About log₂ n
- 5. B · Overlapping subproblems and optimal substructure
- 6. B · O(n²)
- 7. A · After V − 1 rounds, it checks whether any edge can still be relaxed
- 8. A · A vertex is finalised when extracted, but a later negative edge could still give it a shorter path
Full step-by-step solutions: practise this topic on examproblems.com.