1.Easy
What does the average-case running time describe?
- AThe expected time over a given distribution of inputs of size n
- BThe time on the most common computer
- CThe middle value between the best-case and worst-case running times
- DThe time for an input of average length
2.Easy
What does f(n) = Θ(g(n)) mean?
- Af grows strictly slower than g
- Bf grows at the same rate as g, bounded above and below by constant multiples of g
- Cf grows strictly faster than g
- Df is always smaller than g for every n, so g bounds it from above but never from below
3.Easy
A loop starts with i = 1 and doubles i each iteration until i > n. How many iterations does it run?
- AAbout n²
- BAbout log₂ n
- CAbout n
- DAbout n / 2
4.Medium
How much stack space does a simple recursive factorial function fact(n) = n × fact(n − 1) use?
- AO(n)
- BO(n²)
- CO(1)
- DO(log n)
5.Medium
What is the time complexity of the Bellman–Ford algorithm on a graph with V vertices and E edges?
- AO(V × E)
- BO(V³ × E)
- CO(V + E)
- DO(E log V)
6.Medium
What is the time complexity of multiplying two n × n matrices with the standard triple loop?
- AO(n² log n)
- BO(n)
- CO(n³)
- DO(n²)
7.Hard
Why is the average lookup in a hash table O(1) but the worst case O(n)?
- AHash functions are slow
- BKeys must be sorted first
- CMany keys may collide into the same bucket
- DArrays have O(n) 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 √n)
- BO(n²)
- CO(n log n)
- DO(n)
Answer key
- 1. A · The expected time over a given distribution of inputs of size n
- 2. B · f grows at the same rate as g, bounded above and below by constant multiples of g
- 3. B · About log₂ n
- 4. A · O(n)
- 5. A · O(V × E)
- 6. C · O(n³)
- 7. C · Many keys may collide into the same bucket
- 8. C · O(n log n)
Full step-by-step solutions: practise this topic on examproblems.com.