1.Easy
What is the Big O of 3n² + 5n + 2?
- AO(3n²)
- BO(5n)
- CO(n²)
- DO(n³)
2.Easy
Which sorting algorithm chooses a pivot and partitions the array into smaller and larger elements?
- AMerge sort
- BQuicksort
- CBubble sort
- DInsertion sort
3.Easy
What is the best-case time complexity of insertion sort, on an already sorted array?
- AO(n log n)
- BO(n)
- CO(n²)
- DO(1)
4.Medium
What does the Floyd–Warshall algorithm compute, and how fast?
- AA topological order in O(V²)
- BA minimum spanning tree in O(E log V)
- CShortest paths between all pairs of vertices in O(V³)
- DShortest paths from one source vertex to all others in O(V + E)
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
- BAll logarithms in computer science have base 10, so it is implied
- CThe base only matters for small n
- DLogarithms are always rounded to integers
6.Medium
What is the time complexity of the standard dynamic programming algorithm for the longest common subsequence of strings of lengths m and n?
- AO(mn)
- BO(mn log n)
- CO(2m+n)
- DO(m + n)
7.Hard
For which knapsack variant does the greedy rule "take items in order of value per weight" always give an optimal answer?
- ANeither variant
- BBoth variants
- CThe fractional knapsack, where items may be split
- DThe 0/1 knapsack, where items must always be taken whole
8.Hard
Why does binary search not give O(log n) time on a singly linked list?
- ALinked lists cannot be sorted
- BBinary search needs at least twice the memory
- CComparisons on linked list nodes are slower
- DReaching the middle element takes O(n) steps, since there is no direct index access
Answer key
- 1. C · O(n²)
- 2. B · Quicksort
- 3. B · O(n)
- 4. C · Shortest paths between all pairs of vertices in O(V³)
- 5. A · Logarithms with different bases differ only by a constant factor
- 6. A · O(mn)
- 7. C · The fractional knapsack, where items may be split
- 8. D · Reaching the middle element takes O(n) steps, since there is no direct index access
Full step-by-step solutions: practise this topic on examproblems.com.