1.Easy
What are the three steps of a divide-and-conquer algorithm?
- ASort, search, return
- BDivide, conquer, combine
- CRead, compute, write
- DGuess, check, repeat
2.Easy
A loop starts with i = 1 and doubles i each iteration until i > n. How many iterations does it run?
- AAbout n²
- BAbout log₂ n
- CAbout n / 2
- DAbout n
3.Easy
Which notation describes a lower bound on growth?
- Ao (little o)
- BΘ (Big Theta)
- CΩ (Big Omega)
- DO (Big O)
4.Medium
Why does dynamic programming give no real speed-up for merge sort?
- AMerge sort is already O(n)
- BDynamic programming only works on graph problems, not on arrays
- CIts subproblems do not overlap, so there is nothing to reuse
- DMerge sort has no recursive structure
5.Medium
Which algorithm finds the shortest paths from one source in a graph with non-negative edge weights?
- AKruskal's algorithm
- BDepth-first search
- CBellman–Ford is required in all cases
- DDijkstra's algorithm
6.Medium
How does Prim's algorithm build a minimum spanning tree?
- AIt runs breadth-first search and keeps the BFS tree
- BIt sorts all edges by weight and adds each one unless it would form a cycle in the forest
- CIt grows one tree from a start vertex, adding the cheapest edge that leaves the tree
- DIt removes the most expensive edge until no cycles remain
7.Hard
What would follow if someone found a polynomial-time algorithm for one NP-complete problem?
- AThe halting problem would become decidable
- BOnly that one problem would move into P
- CEvery problem in NP could be solved in polynomial time, so P = NP
- DAll exponential-time algorithms would immediately run in linear time
8.Hard
Shortest simple paths can be found in polynomial time. What is known about finding the longest simple path between two vertices in a general graph?
- AIt is undecidable
- BIt can be solved by Dijkstra's algorithm with negated weights
- CIt is always solvable in O(V + E)
- DIt is NP-hard
Answer key
- 1. B · Divide, conquer, combine
- 2. B · About log₂ n
- 3. C · Ω (Big Omega)
- 4. C · Its subproblems do not overlap, so there is nothing to reuse
- 5. D · Dijkstra's algorithm
- 6. C · It grows one tree from a start vertex, adding the cheapest edge that leaves the tree
- 7. C · Every problem in NP could be solved in polynomial time, so P = NP
- 8. D · It is NP-hard
Full step-by-step solutions: practise this topic on examproblems.com.