1.Easy
What is a brute-force algorithm?
- AOne that always uses recursion
- BOne that guesses an answer at random
- COne that tries all possible candidate solutions
- DOne that runs on many processors
2.Easy
What is the running time of counting sort for n integers in the range 0 to k?
- AO(n²)
- BO(n log n)
- CO(k log n)
- DO(n + k)
3.Easy
What is O(2ⁿ) growth called?
- ALogarithmic
- BPolynomial
- CExponential
- DLinear
4.Medium
A greedy algorithm:
- AAlways gives the optimal solution
- BUses only recursion
- CMakes the locally best choice at each step
- DTries every possible solution
5.Medium
Which algorithm finds the shortest paths from one source in a graph with non-negative edge weights?
- ABellman–Ford is required in all cases
- BDijkstra's algorithm
- CDepth-first search
- DKruskal's algorithm
6.Medium
Is it correct to say that an O(n²) algorithm is also O(n³)?
- ANo, because n³ is smaller than n² for large n
- BYes, but only if n is smaller than 100
- CYes, because Big O is an upper bound and n² grows no faster than n³
- DNo, because Big O must always state the exact growth rate of the function
7.Hard
Which bound is correct for log(n!)?
- AΘ(log n)
- BΘ(n)
- CΘ(n log n)
- DΘ(n²)
8.Hard
Which definition of the class P is correct?
- AProblems whose solutions can be checked but never found in polynomial time
- BDecision problems solvable by a deterministic algorithm in polynomial time
- CProblems that need exponential time on every computer
- DProblems that can be solved in parallel
Answer key
- 1. C · One that tries all possible candidate solutions
- 2. D · O(n + k)
- 3. C · Exponential
- 4. C · Makes the locally best choice at each step
- 5. B · Dijkstra's algorithm
- 6. C · Yes, because Big O is an upper bound and n² grows no faster than n³
- 7. C · Θ(n log n)
- 8. B · Decision problems solvable by a deterministic algorithm in polynomial time
Full step-by-step solutions: practise this topic on examproblems.com.