1.Easy
What does the average-case running time describe?
- AThe expected time over a given distribution of inputs of size n
- BThe time for an input of average length
- CThe middle value between the best-case and worst-case running times
- DThe time on the most common computer
2.Easy
What is a brute-force algorithm?
- AOne that always uses recursion
- BOne that tries all possible candidate solutions
- COne that runs on many processors
- DOne that guesses an answer at random
3.Easy
Which notation describes an upper bound on growth?
- ABig Theta
- BLittle omega
- CBig O
- DBig Omega
4.Medium
Why do many library sorting routines switch to insertion sort for very small subarrays?
- ARecursive algorithms cannot handle arrays below 10 elements
- BInsertion sort is O(n log n) in the worst case
- CInsertion sort uses less memory than any other sorting algorithm on large inputs
- DInsertion sort has little overhead and is fast on small or nearly sorted inputs
5.Medium
Which statement about a recursive function without a reachable base case is correct?
- AIt keeps calling itself until the call stack overflows
- BIt runs in O(1) time
- CThe compiler always turns it into a loop that ends safely
- DIt returns 0 automatically
6.Medium
Which sorting algorithm is stable?
- AHeap sort
- BMerge sort
- CQuicksort (typical in-place version)
- DSelection sort (typical version)
7.Hard
Which statement about little-o notation is correct?
- An² = o(n)
- Bn = o(n²), but n is not o(n)
- C2n = o(n), because 2n grows slowly
- Dn = o(n), since every function is little-o of itself
8.Hard
Why is the average lookup in a hash table O(1) but the worst case O(n)?
- AMany keys may collide into the same bucket
- BKeys must be sorted first
- CArrays have O(n) access
- DHash functions are slow
Answer key
- 1. A · The expected time over a given distribution of inputs of size n
- 2. B · One that tries all possible candidate solutions
- 3. C · Big O
- 4. D · Insertion sort has little overhead and is fast on small or nearly sorted inputs
- 5. A · It keeps calling itself until the call stack overflows
- 6. B · Merge sort
- 7. B · n = o(n²), but n is not o(n)
- 8. A · Many keys may collide into the same bucket
Full step-by-step solutions: practise this topic on examproblems.com.