Any sorting algorithm that compares two items — or a pair — at a time in the process of sorting through a larger dataset is referred to as a comparison sort. This subset of algorithms use some type of comparator (for example:
<=) to determine which o…
…be ordered in the same way in the list as they appeared before they were sorted. On the other hand, an unstable algorithm is one where there is no guarantee that, if two items are found to have the same sort key, that their relative order will be preserved.