A Sorting algorithm is considered stable if two objects with equal keys appear in the same order in the sorted output as they do in the input array:

Some stable sorting algorithms are:

Example

In this example the lists are sorted based on a key integer.

Input List:

{1, "a"}, {4, "b"}, {3, "c"}, {3, "d"}

Output List:

{1, "a"}, {3, "c"}, {3, "d"}, {4, "b"},