1.Easy
What does binary search require of its input?
- AThe array must have no more than 1000 elements
- BThe array length must be a power of two
- CThe array must contain only positive numbers
- DThe array must be sorted
2.Easy
What is a brute-force algorithm?
- AOne that guesses an answer at random
- BOne that always uses recursion
- COne that tries all possible candidate solutions
- DOne that runs on many processors
3.Easy
Which design strategy does merge sort use?
- ADivide and conquer
- BGreedy choice
- CBrute force
- DDynamic programming
4.Medium
What is the time complexity of: for i = 1 to n: for j = 1 to i: do O(1) work?
- AO(n²)
- BO(n log n)
- CO(n³)
- DO(n)
5.Medium
What is the worst-case time complexity of quicksort?
- AO(n)
- BO(n log n)
- CO(log n)
- DO(n²)
6.Medium
What is the time complexity of multiplying two n × n matrices with the standard triple loop?
- AO(n²)
- BO(n³)
- CO(n)
- DO(n² log n)
7.Hard
To show that a new problem X is NP-hard, what must you do?
- AShow that X can be verified in polynomial time
- BReduce a known NP-hard problem to X in polynomial time
- CReduce X to a known NP-hard problem in polynomial time
- DShow that X has no polynomial algorithm for small inputs
8.Hard
Which definition of the class NP is correct?
- AProblems that are not polynomial
- BDecision problems whose yes-answers can be verified in polynomial time given a certificate
- CProblems that cannot be solved in polynomial time
- DProblems that no algorithm can solve
Answer key
- 1. D · The array must be sorted
- 2. C · One that tries all possible candidate solutions
- 3. A · Divide and conquer
- 4. A · O(n²)
- 5. D · O(n²)
- 6. B · O(n³)
- 7. B · Reduce a known NP-hard problem to X in polynomial time
- 8. B · Decision problems whose yes-answers can be verified in polynomial time given a certificate
Full step-by-step solutions: practise this topic on examproblems.com.