Skip to content

Latest commit

 

History

History
 
 

Cocktail Selection Sort

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Cocktail selection sort, also known as cocktail shaker sort, is a variant on bubble sort.

The algorithm differs from a bubble sort in that it sorts in both directions on each pass through the list. This sorting algorithm is only marginally more difficult to implement than a bubble sort, and solves the problem of turtles(https://en.wikipedia.org/wiki/Bubble_sort#Rabbits_and_turtles) in bubble sorts. It provides only marginal performance improvements, and does not improve asymptotic performance; like the bubble sort, it is not of practical interest (insertion sort is preferred for simple sorts), though it finds some use in education.

The complexity of Cocktail Selection Sort is equal to the big O notation of O(n^2) for both the worse and the average case.