1.Easy
What is the worst-case time complexity of insertion sort?
- AO(n log n)
- BO(n)
- CO(n²)
- DO(log n)
2.Easy
What is O(2ⁿ) growth called?
- ALogarithmic
- BPolynomial
- CLinear
- DExponential
3.Easy
What is log₂ 1024?
- A512
- B10
- C12
- D32
4.Medium
What does the recurrence T(n) = 2T(n − 1) + O(1) solve to?
- AO(n)
- BO(n²)
- CO(2ⁿ)
- DO(n log n)
5.Medium
How does Prim's algorithm build a minimum spanning tree?
- AIt sorts all edges by weight and adds each one unless it would form a cycle in the forest
- BIt runs breadth-first search and keeps the BFS tree
- CIt removes the most expensive edge until no cycles remain
- DIt grows one tree from a start vertex, adding the cheapest edge that leaves the tree
6.Medium
Is it correct to say that an O(n²) algorithm is also O(n³)?
- ANo, because Big O must always state the exact growth rate of the function
- BYes, because Big O is an upper bound and n² grows no faster than n³
- CYes, but only if n is smaller than 100
- DNo, because n³ is smaller than n² for large n
7.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 always solvable in O(V + E)
- BIt is undecidable
- CIt can be solved by Dijkstra's algorithm with negated weights
- DIt is NP-hard
8.Hard
What does the recurrence T(n) = 2T(n/2) + n log n solve to?
- AΘ(n log n)
- BΘ(n log² n)
- CΘ(n)
- DΘ(n²)
Answer key
- 1. C · O(n²)
- 2. D · Exponential
- 3. B · 10
- 4. C · O(2ⁿ)
- 5. D · It grows one tree from a start vertex, adding the cheapest edge that leaves the tree
- 6. B · Yes, because Big O is an upper bound and n² grows no faster than n³
- 7. D · It is NP-hard
- 8. B · Θ(n log² n)
Full step-by-step solutions: practise this topic on examproblems.com.