1.Easy
What does binary search require of its input?
- AThe array must be sorted
- BThe array must have no more than 1000 elements
- CThe array length must be a power of two
- DThe array must contain only positive numbers
2.Easy
What does it mean if an operation runs in O(1) time?
- AIt always takes exactly one second
- BIt can only be run once
- CIts running time does not grow with the input size
- DIt processes exactly one element per second of running time
3.Easy
A problem is usually called tractable if:
- AIt can only be solved by trying every possibility
- BIt can be solved in polynomial time
- CIt can be solved in constant time
- DIt has no solution
4.Medium
What does it mean that a problem has optimal substructure?
- AEvery subproblem has the same size
- BThe problem has exactly one optimal solution, which every subproblem shares
- CThe problem can be solved in constant time
- DAn optimal solution can be built from optimal solutions of its subproblems
5.Medium
What is the worst-case time complexity of quicksort?
- AO(n)
- BO(n log n)
- CO(n²)
- DO(log n)
6.Medium
What does the recurrence T(n) = 2T(n − 1) + O(1) solve to?
- AO(2ⁿ)
- BO(n log n)
- CO(n²)
- DO(n)
7.Hard
What is the difference between an undecidable problem and an intractable one?
- AUndecidable problems are in NP, while intractable problems are in P
- BAn undecidable problem has no algorithm for all inputs; an intractable one has one, but it is too slow
- CIntractable problems cannot be solved by any algorithm, while undecidable ones only need exponential time
- DBoth mean the problem has no algorithm at all
8.Hard
Which two things must be shown to prove that a decision problem X is NP-complete?
- AX is in NP, and a known NP-complete problem reduces to X in polynomial time
- BX has no polynomial algorithm, and X is decidable
- CX is in P, and X reduces to SAT
- DX reduces to a problem in P, and X is in NP
Answer key
- 1. A · The array must be sorted
- 2. C · Its running time does not grow with the input size
- 3. B · It can be solved in polynomial time
- 4. D · An optimal solution can be built from optimal solutions of its subproblems
- 5. C · O(n²)
- 6. A · O(2ⁿ)
- 7. B · An undecidable problem has no algorithm for all inputs; an intractable one has one, but it is too slow
- 8. A · X is in NP, and a known NP-complete problem reduces to X in polynomial time
Full step-by-step solutions: practise this topic on examproblems.com.