A sorting technique in which pairs of adjacent values in the
list to be sorted are compared and interchanged if they are
out of order; thus, list entries "bubble upward" in the list
until they bump into one with a lower sort value. Because it
is not very good relative to other methods and is the one
typically stumbled on by naive and untutored programmers,
hackers consider it the canonical example of a naive
algorithm. The canonical example of a really *bad* algorithm
is bogo-sort. A bubblesort might be used out of ignorance,
but any use of bogo-sort could issue only from brain damage or
willful perversity.
[Jargon File]
<algorithm> A bi-directional bubble sort. Passes alternate
between ascending through array indexes, pushing the largest
item to the bottom; and descending through array indexes,
pushing the smallest item to the top.
[Performace vs plain bubble?]
(2001-03-26)
Cocktail shaker sort, also known as bidirectional bubblesort, cocktail sort, shaker sort (which can also refer to a variant of selection sort), ripple sort, shuffle sort, or shuttle sort, is an extension of bubblesort. The algorithm extends bubblesort by operating in two directions.