1.Easy
What is the time complexity of finding the largest value in an unsorted array of n numbers?
- AO(n log n)
- BO(1)
- CO(n)
- DO(log n)
2.Easy
What are the three steps of a divide-and-conquer algorithm?
- ASort, search, return
- BRead, compute, write
- CDivide, conquer, combine
- DGuess, check, repeat
3.Easy
Accessing an element by index in an array takes:
- AO(1)
- BO(log n)
- CO(n)
- DO(n²)
4.Medium
Why does dynamic programming give no real speed-up for merge sort?
- AIts subproblems do not overlap, so there is nothing to reuse
- BMerge sort is already O(n)
- CDynamic programming only works on graph problems, not on arrays
- DMerge sort has no recursive structure
5.Medium
What does the Floyd–Warshall algorithm compute, and how fast?
- AA minimum spanning tree in O(E log V)
- BShortest paths between all pairs of vertices in O(V³)
- CShortest paths from one source vertex to all others in O(V + E)
- DA topological order in O(V²)
6.Medium
How much stack space does a simple recursive factorial function fact(n) = n × fact(n − 1) use?
- AO(log n)
- BO(n²)
- CO(1)
- DO(n)
7.Hard
Which statement about selecting the k-th smallest element of an unsorted array is correct?
- ASelection is only possible in O(n²)
- BSelection always needs Ω(n log n) because it requires sorting
- CQuickselect runs in O(log n) worst case, because it recurses on only one side of the pivot
- DQuickselect runs in expected O(n), and median-of-medians guarantees O(n) worst case
8.Hard
How do n! and 2ⁿ compare for large n?
- An! grows faster than 2ⁿ
- B2ⁿ grows faster than n!
- Cn! is O(n²)
- DThey grow at the same rate
Answer key
- 1. C · O(n)
- 2. C · Divide, conquer, combine
- 3. A · O(1)
- 4. A · Its subproblems do not overlap, so there is nothing to reuse
- 5. B · Shortest paths between all pairs of vertices in O(V³)
- 6. D · O(n)
- 7. D · Quickselect runs in expected O(n), and median-of-medians guarantees O(n) worst case
- 8. A · n! grows faster than 2ⁿ
Full step-by-step solutions: practise this topic on examproblems.com.