1.Easy
What is the time complexity of finding the largest value in an unsorted array of n numbers?
- AO(1)
- BO(n)
- CO(log n)
- DO(n log n)
2.Easy
What is the Big O of 3n² + 5n + 2?
- AO(3n²)
- BO(5n)
- CO(n³)
- DO(n²)
3.Easy
Which notation describes a lower bound on growth?
- AΩ (Big Omega)
- Bo (little o)
- CO (Big O)
- DΘ (Big Theta)
4.Medium
With coins of 1, 3 and 4 and an amount of 6, how many coins does the greedy "largest coin first" method use, compared to the optimum?
- AGreedy uses 3 coins; the optimum is 3
- BGreedy uses 3 coins; the optimum is 2
- CGreedy uses 2 coins; the optimum is 2
- DGreedy uses 4 coins; the optimum is 3
5.Medium
The lower bound for comparison-based sorting in the worst case is:
- AΩ(n)
- BΩ(n²)
- CΩ(n log n)
- DΩ(log n)
6.Medium
Why is the base of a logarithm usually left out in Big O, as in O(log n)?
- ALogarithms are always rounded to integers
- BAll logarithms in computer science have base 10, so it is implied
- CLogarithms with different bases differ only by a constant factor
- DThe base only matters for small n
7.Hard
What did the Cook–Levin theorem establish?
- AEvery NP problem can be solved in exponential time
- BP is not equal to NP
- CThe halting problem is undecidable
- DThe Boolean satisfiability problem (SAT) is NP-complete
8.Hard
To show that a new problem X is NP-hard, what must you do?
- AShow that X has no polynomial algorithm for small inputs
- BReduce a known NP-hard problem to X in polynomial time
- CShow that X can be verified in polynomial time
- DReduce X to a known NP-hard problem in polynomial time
Answer key
- 1. B · O(n)
- 2. D · O(n²)
- 3. A · Ω (Big Omega)
- 4. B · Greedy uses 3 coins; the optimum is 2
- 5. C · Ω(n log n)
- 6. C · Logarithms with different bases differ only by a constant factor
- 7. D · The Boolean satisfiability problem (SAT) is NP-complete
- 8. B · Reduce a known NP-hard problem to X in polynomial time
Full step-by-step solutions: practise this topic on examproblems.com.