Sorting medium time O(n log n) space O(n)
Merge Sort
Recursively split the array in half until each piece is one element, then merge sorted pieces back together. Each merge fills a separate buffer one value at a time — comparing the fronts of the two halves — then copies the buffer back, so no value is ever lost or duplicated.
Merge sort: split down to single elements, then merge through a buffer.
1 / 40
Practice
Machine twin: /dsa-viz-v2/merge-sort.json — the full deterministic run as structured data.