Easy Algorithms Sorting Algorithms
What is the difference between stable and unstable sorting algorithms?
Answer
A stable sort preserves the relative order of elements with equal keys - if two elements are equal, they appear in the same order in the sorted output as in the input. Unstable sorts may change this relative order. Stable sorts: Merge sort, Insertion sort, Bubble sort. Unstable sorts: Quick sort, Heap sort, Selection sort. Stability matters when sorting by multiple fields or when preserving original order for ties is important.
IIT Certified
Master These Concepts with IIT Certification
175+ hours of industry projects. Get placed at Bosch, Tata Motors, L&T and 500+ companies.
Relevant for Roles
Software Engineer Backend Developer Data Engineer