Posts tagged with 'stable'


Stability in Insertion Sort

There are two types of sort algorithm: those that are stable and those that are not. Stable sorts maintain the order of items that are deemed equal, whereas unstable sorts make no such guarantees. So if we have a small set of unordered cards, and we’re sorting on pip value, ignoring suits, the following unordered list: 3♠ 2♣ 3♦ 2♥ 3♣ would be stable sorted as: 2♣ 2♥ 3♠ 3♦ 3♣ since the 2 of clubs appeared before the 2 of hearts in the original list, and the 3s are maintained in the original order...

READ MORE