1.Easy
What is the time complexity of finding the largest value in an unsorted array of n numbers?
- AO(n log n)
- BO(log n)
- CO(n)
- DO(1)
2.Easy
How does selection sort work?
- AIt splits the array in halves and merges them
- BIt inserts each element into a growing sorted part by shifting
- CIt repeatedly finds the minimum of the unsorted part and swaps it to the front
- DIt repeatedly swaps neighbouring elements that are in the wrong order
3.Easy
What is an algorithm?
- AA finite sequence of well-defined steps that solves a problem
- BAny computer program that has a graphical interface
- CA data structure that stores numbers
- DA programming language designed for writing mathematical formulas
4.Medium
The lower bound for comparison-based sorting in the worst case is:
- AΩ(n²)
- BΩ(n log n)
- CΩ(log n)
- DΩ(n)
5.Medium
Why does dynamic programming give no real speed-up for merge sort?
- ADynamic programming only works on graph problems, not on arrays
- BIts subproblems do not overlap, so there is nothing to reuse
- CMerge sort has no recursive structure
- DMerge sort is already O(n)
6.Medium
What is the time complexity of computing the n-th Fibonacci number with a bottom-up table?
- AO(log n)
- BO(2ⁿ)
- CO(n²)
- DO(n)
7.Hard
Which two things must be shown to prove that a decision problem X is NP-complete?
- AX is in P, and X reduces to SAT
- BX is in NP, and a known NP-complete problem reduces to X in polynomial time
- CX has no polynomial algorithm, and X is decidable
- DX reduces to a problem in P, and X is in NP
8.Hard
Which statement about little-o notation is correct?
- An = o(n²), but n is not o(n)
- Bn² = o(n)
- Cn = o(n), since every function is little-o of itself
- D2n = o(n), because 2n grows slowly
Answer key
- 1. C · O(n)
- 2. C · It repeatedly finds the minimum of the unsorted part and swaps it to the front
- 3. A · A finite sequence of well-defined steps that solves a problem
- 4. B · Ω(n log n)
- 5. B · Its subproblems do not overlap, so there is nothing to reuse
- 6. D · O(n)
- 7. B · X is in NP, and a known NP-complete problem reduces to X in polynomial time
- 8. A · n = o(n²), but n is not o(n)
Full step-by-step solutions: practise this topic on examproblems.com.