Skip to content
Sortingcore

Merge Sort

A divide-and-conquer sort that recursively splits the array in half, sorts each half, then merges the two sorted halves back together. Guarantees O(n log n) and is stable, at the cost of O(n) auxiliary space.

Best
O(n log n)
Average
O(n log n)
Worst
O(n log n)
Space
O(n)
Stable
Yes