1.Easy
What does it mean if an operation runs in O(1) time?
- AIt processes exactly one element per second of running time
- BIt can only be run once
- CIts running time does not grow with the input size
- DIt always takes exactly one second
2.Easy
Which of these running times is polynomial?
- AO(nⁿ)
- BO(n!)
- CO(2ⁿ)
- DO(n³)
3.Easy
What is log₂ 1024?
- A10
- B512
- C12
- D32
4.Medium
Why is the base of a logarithm usually left out in Big O, as in O(log n)?
- AAll logarithms in computer science have base 10, so it is implied
- BLogarithms with different bases differ only by a constant factor
- CThe base only matters for small n
- DLogarithms are always rounded to integers
5.Medium
What is the time complexity of: for i = 1 to n: for j = 1 to i: do O(1) work?
- AO(n log n)
- BO(n³)
- CO(n²)
- DO(n)
6.Medium
What does it mean that a problem has optimal substructure?
- AEvery subproblem has the same size
- BThe problem can be solved in constant time
- CThe problem has exactly one optimal solution, which every subproblem shares
- DAn optimal solution can be built from optimal solutions of its subproblems
7.Hard
Why does binary search not give O(log n) time on a singly linked list?
- ALinked lists cannot be sorted
- BComparisons on linked list nodes are slower
- CBinary search needs at least twice the memory
- DReaching the middle element takes O(n) steps, since there is no direct index access
8.Hard
What is the time complexity of: for i = 1 to n: for (j = i; j ≤ n; j = j + i) do O(1) work?
- AO(n)
- BO(n log n)
- CO(n √n)
- DO(n²)
Answer key
- 1. C · Its running time does not grow with the input size
- 2. D · O(n³)
- 3. A · 10
- 4. B · Logarithms with different bases differ only by a constant factor
- 5. C · O(n²)
- 6. D · An optimal solution can be built from optimal solutions of its subproblems
- 7. D · Reaching the middle element takes O(n) steps, since there is no direct index access
- 8. B · O(n log n)
Full step-by-step solutions: practise this topic on examproblems.com.