1.Easy
What does the worst-case running time of an algorithm describe?
- AThe time it takes on the smallest input
- BThe expected time it takes on a random input of size n
- CThe maximum time it takes over all inputs of size n
- DThe time it takes on a slow computer
2.Easy
Which complexity class grows fastest for large n?
- AO(2ⁿ)
- BO(n³)
- CO(n log n)
- DO(n²)
3.Easy
What is recursion?
- AA type of data structure
- BA function that calls itself on smaller inputs
- CA sorting method
- DA loop that never ends
4.Medium
What is the worst-case time complexity of quicksort?
- AO(n²)
- BO(n)
- CO(log n)
- DO(n log n)
5.Medium
The time complexity of naive recursive Fibonacci (fib(n) = fib(n−1) + fib(n−2)) is:
- ALogarithmic
- BExponential
- CConstant
- DLinear
6.Medium
What is the amortised time complexity of appending to a dynamic array that doubles its capacity when full?
- AO(log n)
- BO(1)
- CO(n)
- DO(n²)
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)
- DO((V + E) log V)
8.Hard
Which algorithm finds a minimum spanning tree by repeatedly adding the cheapest edge that does not form a cycle?
- APrim's algorithm starting from one node
- BDijkstra's algorithm
- CKruskal's algorithm
- DFloyd–Warshall
Answer key
- 1. C · The maximum time it takes over all inputs of size n
- 2. A · O(2ⁿ)
- 3. B · A function that calls itself on smaller inputs
- 4. A · O(n²)
- 5. B · Exponential
- 6. B · O(1)
- 7. D · O((V + E) log V)
- 8. C · Kruskal's algorithm
Full step-by-step solutions: practise this topic on examproblems.com.