Which sorting algorithm repeatedly swaps adjacent elements that are in the wrong order?
- ABubble sort
- BHeap sort
- CQuicksort
- DMerge sort
Which sorting algorithm repeatedly swaps adjacent elements that are in the wrong order?
Which of these grows slowest as n becomes large?
An O(n²) algorithm takes 1 second for n = 1000. About how long does it take for n = 2000?
What is the amortised time complexity of appending to a dynamic array that doubles its capacity when full?
A function runs one loop of n iterations and then, separately, another loop of n iterations. What is its time complexity?
What is the time complexity of the standard dynamic programming algorithm for the longest common subsequence of strings of lengths m and n?
What is the amortised cost of incrementing a binary counter, given that one increment may flip many bits?
Taking both endpoints of every edge in a maximal matching gives a vertex cover. How good is this cover?
Full step-by-step solutions: practise this topic on examproblems.com.