Stable Sorting
A stable sorting algorithm preserves the relative order of elements that have equal sorting keys. Stability matters when records contain multiple attributes and sorting is performed in stages.
For example, if employees are first sorted by department and then stably sorted by salary, employees with equal salaries retain their previous department ordering. This is useful in multi-level sorting and data-processing pipelines.