Loading...
Loading...
0
ops.
0
ops.
0
ops.
0
ops.
0
comp.
0
ms
0
sec
0
ops/ms
0
comp/ms
[1] Sum of Swap, Get, Set and Comparison operations.
[2] Swap operations do not count as neither Get nor Set operations.
Cocktail shaker sort, also known as bidirectional bubble sort, cocktail sort, shaker sort, ripple sort, shuffle sort, or shuttle sort, is a variation of bubble sort that is both a stable sorting algorithm and a comparison sort. The algorithm differs from 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 bubble sort, and solves the problem of turtles in bubble sort.
Read moreThe cocktail shaker sort is a variation of bubble sort that is both a stable sorting algorithm and a comparison sort. The algorithm differs from 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 bubble sort and only marginally more efficient than bubble sort, so it is not often used in practice.
Big O Notation | |||
---|---|---|---|
Time complexity | Space complexity | ||
Worst | Average | Best | Worst |
O(n^2) | Θ(n^2) | Ω(n) | O(1) |
Big O Notation defines the lower, average and upper bounds of an algorithm, where Time complexity determines the amount of operations, and Space complexity the amount of memory that can be used
This site uses cookies to ensure you the best experiences of all.
By continuing, I must assume you're okay with them, however, you can read more about them here.
Continue