A simple, but not very efficient, algorithm for arranging a set of n numbers in order of magnitude. The method starts with the left-hand pair of numbers, swapping them if necessary. The second and third numbers are now considered. If they are swapped then the first pair are reconsidered. Next the third and fourth numbers are considered. If swapped then previous pairs are again reconsidered, working from right to left. As with the bubble sort, ½n(n-1) comparisons may be required.
Shuttle sort. A sorting method based on swaps of pairs of numbers. In the example, × indicates a swap and Ο that no swap is required. The sort works from left to right, reconsidering earlier pairs when a swap is made.
Subjects: Probability and Statistics.