Stability
← Back to Analysis
A sorting algorithm is stable if it preserves the relative order of elements with equal keys. Stability matters when sorting by multiple criteria or when the original order carries meaning. Merge sort and Timsort are stable; quicksort and heapsort are not.