- Mergesort: sort each half recursively, then merge.
- Mergesort uses at most N lg N compares (and ~6 N lg N array accesses).
🎯 How this can come up · 1 question
Mergesort’s running time in the worst case is:
Correct: O(n log n).
- Mergesort needs extra memory proportional to N (the aux array): not in place.
🎯 How this can come up · 1 question
Standard mergesort sorts in place with constant extra memory.
False. It needs an auxiliary array of size N.
- Bottom-up mergesort: merge subarrays of size 1, 2, 4, 8… without recursion.
Asked in a real exam
🎯 How this can come up · 1 question
Merge sort [RUH, AMM, DMM, JED, KWI, DXB, SFO]. (Quiz 2)
Split to single items, then merge: [AMM, RUH] [DMM, JED] [DXB, KWI] [SFO] → [AMM, DMM, JED, RUH] [DXB, KWI, SFO] → [AMM, DMM, DXB, JED, KWI, RUH, SFO].
- Stable sort: equal keys keep their relative order. Insertion and merge sort are stable; selection sort (and quicksort) are not.
🎯 How this can come up · 1 question
Which sort is stable?
Correct: Mergesort.
No slides match this filter.