1.Easy
A problem is usually called tractable if:
- AIt has no solution
- BIt can be solved in polynomial time
- CIt can only be solved by trying every possibility
- DIt can be solved in constant time
2.Easy
Accessing an element by index in an array takes:
- AO(n)
- BO(n²)
- CO(log n)
- DO(1)
3.Easy
What is the time complexity of finding the largest value in an unsorted array of n numbers?
- AO(log n)
- BO(n log n)
- CO(n)
- DO(1)
4.Medium
Is it correct to say that an O(n²) algorithm is also O(n³)?
- AYes, but only if n is smaller than 100
- BNo, because Big O must always state the exact growth rate of the function
- CNo, because n³ is smaller than n² for large n
- DYes, because Big O is an upper bound and n² grows no faster than n³
5.Medium
What does the recurrence T(n) = 2T(n − 1) + O(1) solve to?
- AO(2ⁿ)
- BO(n²)
- CO(n log n)
- DO(n)
6.Medium
The time complexity of naive recursive Fibonacci (fib(n) = fib(n−1) + fib(n−2)) is:
- AExponential
- BLinear
- CLogarithmic
- DConstant
7.Hard
What is the running time of Dijkstra's algorithm with a binary heap on a graph with V vertices and E edges?
- AO(V + E)
- BO(V³)
- CO((V + E) log V)
- DO(V × E)
8.Hard
Which statement about selecting the k-th smallest element of an unsorted array is correct?
- AQuickselect runs in O(log n) worst case, because it recurses on only one side of the pivot
- 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
- DSelection is only possible in O(n²)
Answer key
- 1. B · It can be solved in polynomial time
- 2. D · O(1)
- 3. C · O(n)
- 4. D · Yes, because Big O is an upper bound and n² grows no faster than n³
- 5. A · O(2ⁿ)
- 6. A · Exponential
- 7. C · O((V + E) log V)
- 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.