1.Easy
What is the Big O of 3n² + 5n + 2?
- AO(n²)
- BO(n³)
- CO(3n²)
- DO(5n)
2.Easy
What does the worst-case running time of an algorithm describe?
- AThe time it takes on the smallest input
- BThe time it takes on a slow computer
- CThe maximum time it takes over all inputs of size n
- DThe expected time it takes on a random input of size n
3.Easy
What is the time complexity of depth-first search on a graph stored as adjacency lists?
- AO(V²)
- BO(E log V)
- CO(V × E)
- DO(V + E)
4.Medium
What is the worst-case time complexity of quicksort?
- AO(log n)
- BO(n)
- CO(n²)
- DO(n log n)
5.Medium
What does the recurrence T(n) = 2T(n/2) + O(1) solve to?
- AO(n)
- BO(log n)
- CO(n log n)
- DO(n²)
6.Medium
What is the time complexity of: for i = 1 to n: for j = 1 to i: do O(1) work?
- AO(n)
- BO(n log n)
- CO(n³)
- DO(n²)
7.Hard
Why does binary search not give O(log n) time on a singly linked list?
- ALinked lists cannot be sorted
- BReaching the middle element takes O(n) steps, since there is no direct index access
- CComparisons on linked list nodes are slower
- DBinary search needs at least twice the memory
8.Hard
For which knapsack variant does the greedy rule "take items in order of value per weight" always give an optimal answer?
- AThe 0/1 knapsack, where items must always be taken whole
- BThe fractional knapsack, where items may be split
- CBoth variants
- DNeither variant
Answer key
- 1. A · O(n²)
- 2. C · The maximum time it takes over all inputs of size n
- 3. D · O(V + E)
- 4. C · O(n²)
- 5. A · O(n)
- 6. D · O(n²)
- 7. B · Reaching the middle element takes O(n) steps, since there is no direct index access
- 8. B · The fractional knapsack, where items may be split
Full step-by-step solutions: practise this topic on examproblems.com.