--- from: http://rosettacode.org/wiki/Order_by_pair_comparisons note: Sorting Algorithms