Reference
[1] https://www.geeksforgeeks.org/stable-quicksort/
A sorting algorithm is said to be stable if it maintains the relative order of records in the case of equality of keys.
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.
QuickSort is an unstable algorithm because we do swapping of elements according to pivot’s position (without considering their original positions).
If Swap is every expensive, better stability is expected.
原文:https://www.cnblogs.com/codingforum/p/10504080.html