What is mean by stable sorting algorithm?
What is mean by stable sorting algorithm? Correct Answer A sorting algorithm is stable if it preserves the order of duplicate keys
Concept
The stability of a sorting algorithm is concerned with how the algorithm treats equal (or repeated) elements.
A sorting algorithm is said to be stable if two objects with equal keys appear in the same order in sorted output as they appear in the input array to be sorted.
[ src="//storage.googleapis.com/tb-img/production/20/05/F1_R.S_21.5.20_Pallavi_D5.png" style="width: 566px; height: 162px;">
Some sorting algorithms are stable by nature like Insertion sort, Merge Sort, Bubble Sort, etc. And some sorting algorithms are not, like Heap Sort, Quick Sort, etc.
মোঃ আরিফুল ইসলাম
Feb 20, 2025