Comparison sort

Computer/Terms 2008. 4. 14. 11:21

A comparison sort is a type of sorting algorithm that only reads the list elements through a single abstract comparison operation (often a "less than or equal to" operator) that determines which of two elements should occur first in the final sorted list. The only requirement is that the operator obey the three defining properties of a total order:

1. if a ≤ b and b ≤ a then a = b (antisymmetry)
2. if a ≤ b and b ≤ c then a ≤ c (transitivity)
3. a ≤ b or b ≤ a (totalness or trichotomy)

A metaphor for thinking about comparison sorts is that you have a set of unlabelled weights and a balance scale. The goal is to line up the weights in order by their weight without any information except that obtained by placing two weights on the scale and seeing which one is heavier (or if they weigh the same).

Reference:
http://en.wikipedia.org/wiki/Comparison_sort

Posted by 알 수 없는 사용자
,