1.Easy
What is log₂ 1024?
- A10
- B512
- C12
- D32
2.Easy
What is the time complexity of finding the largest value in an unsorted array of n numbers?
- AO(n log n)
- BO(1)
- CO(log n)
- DO(n)
3.Easy
What are the three steps of a divide-and-conquer algorithm?
- AGuess, check, repeat
- BRead, compute, write
- CSort, search, return
- DDivide, conquer, combine
4.Medium
In a sorted array, you look for two elements that sum to a target by moving one pointer from each end inwards. What is the time complexity?
- AO(log n)
- BO(n log n)
- CO(n)
- DO(n²)
5.Medium
What is the running time of LSD radix sort on n integers with d digits in base k?
- AO(n log n)
- BO(n²)
- CO(d(n + k))
- DO(dn log k)
6.Medium
What does the recurrence T(n) = T(n/2) + O(1) solve to?
- AO(n log n)
- BO(log n)
- CO(n)
- DO(1)
7.Hard
The halting problem shows that:
- ALoops should be avoided
- BNo algorithm can decide for every program and input whether it halts
- CSome programs run faster on faster computers, so halting depends on hardware
- DEvery program eventually halts
8.Hard
Why does any comparison-based search in a sorted array need Ω(log n) comparisons in the worst case?
- AComparisons take logarithmic time each
- BBinary search is the only possible algorithm, and it needs log₂ n comparisons
- CEvery element must be compared at least once
- DA decision tree with n possible outcomes must have depth at least log₂ n
Answer key
- 1. A · 10
- 2. D · O(n)
- 3. D · Divide, conquer, combine
- 4. C · O(n)
- 5. C · O(d(n + k))
- 6. B · O(log n)
- 7. B · No algorithm can decide for every program and input whether it halts
- 8. D · A decision tree with n possible outcomes must have depth at least log₂ n
Full step-by-step solutions: practise this topic on examproblems.com.