Encyclopedia > Cocktail sort

  Article Content

Cocktail sort

Cocktail sort, also known as bidirectional bubble sort, cocktail shaker sort, or shaker sort, is a stable sorting algorithm that varies from bubble sort in that instead of repeatedly passing through the list from top to bottom, it passes alternately from top to bottom and then from bottom to top. Complexity in Big O notation is O(n²) for a worst case, but becomes closer to O(n) if the list is mostly ordered at the beginning.



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
Islip Terrace, New York

... there are 93.6 males. The median income for a household in the town is $66,644, and the median income for a family is $69,389. Males have a median income of $51,036 ...

 
 
 
This page was created in 35.1 ms