1.Easy
What is the time complexity of linear search in an unsorted array of n elements (worst case)?
- AO(n)
- BO(log n)
- CO(1)
- DO(n²)
2.Easy
Which of these running times is polynomial?
- AO(n³)
- BO(nⁿ)
- CO(n!)
- DO(2ⁿ)
3.Easy
Which sorting algorithm repeatedly swaps adjacent elements that are in the wrong order?
- AMerge sort
- BQuicksort
- CHeap sort
- DBubble sort
4.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
- BThe base only matters for small n
- CAll logarithms in computer science have base 10, so it is implied
- DLogarithms are always rounded to integers
5.Medium
How many levels does the recursion of merge sort have for an array of n elements?
- AAbout log₂ n
- BAbout n
- CAbout n / 2
- DAbout √n
6.Medium
What is the time complexity of: for i = 1 to n: (j = 1; while j < n: j = j × 2)?
- AO(n log n)
- BO(n)
- CO(log n)
- DO(n²)
7.Hard
Which of these satisfiability problems is known to be solvable in polynomial time?
- A2-SAT, where each clause has at most two literals
- BGeneral SAT on formulas in conjunctive normal form
- C3-SAT, where each clause has exactly three literals
- DCircuit satisfiability
8.Hard
Topological sorting is possible only for:
- ADirected acyclic graphs
- BUndirected graphs
- CComplete graphs
- DGraphs with negative weights
Answer key
- 1. A · O(n)
- 2. A · O(n³)
- 3. D · Bubble sort
- 4. A · Logarithms with different bases differ only by a constant factor
- 5. A · About log₂ n
- 6. A · O(n log n)
- 7. A · 2-SAT, where each clause has at most two literals
- 8. A · Directed acyclic graphs
Full step-by-step solutions: practise this topic on examproblems.com.