Sorting
TimeO(n log n)SpaceO(n)
Recursively split the array into halves until each piece is trivially sorted, then merge sorted halves back together using a small buffer. Stable, O(n log n).
Key idea. Split to single elements, then merge sorted halves. Guaranteed O(n log n) and stable — the trade-off is the O(n) buffer.
1
Loading…
—