1.Easy
What is the time complexity of linear search in an unsorted array of n elements (worst case)?
- AO(n²)
- BO(log n)
- CO(1)
- DO(n)
2.Easy
An algorithm with two nested loops, each running n times, typically has which complexity?
- AO(n)
- BO(2n)
- CO(log n)
- DO(n²)
3.Easy
What are the three steps of a divide-and-conquer algorithm?
- ASort, search, return
- BGuess, check, repeat
- CDivide, conquer, combine
- DRead, compute, write
4.Medium
What does the recurrence T(n) = T(n − 1) + O(n) solve to?
- AO(n)
- BO(2ⁿ)
- CO(n log n)
- DO(n²)
5.Medium
Why is the base of a logarithm usually left out in Big O, as in O(log n)?
- ALogarithms with different bases differ only by a constant factor
- BLogarithms are always rounded to integers
- CAll logarithms in computer science have base 10, so it is implied
- DThe base only matters for small n
6.Medium
The lower bound for comparison-based sorting in the worst case is:
- AΩ(n)
- BΩ(n log n)
- CΩ(n²)
- DΩ(log 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 can be solved by Dijkstra's algorithm with negated weights
- BIt is undecidable
- CIt is always solvable in O(V + E)
- DIt is NP-hard
8.Hard
Which statement about selecting the k-th smallest element of an unsorted array is correct?
- ASelection is only possible in O(n²)
- BQuickselect runs in expected O(n), and median-of-medians guarantees O(n) worst case
- CSelection always needs Ω(n log n) because it requires sorting
- DQuickselect runs in O(log n) worst case, because it recurses on only one side of the pivot
Answer key
- 1. D · O(n)
- 2. D · O(n²)
- 3. C · Divide, conquer, combine
- 4. D · O(n²)
- 5. A · Logarithms with different bases differ only by a constant factor
- 6. B · Ω(n log n)
- 7. D · It is NP-hard
- 8. B · Quickselect runs in expected O(n), and median-of-medians guarantees O(n) worst case
Full step-by-step solutions: practise this topic on examproblems.com.