## Optimized bubble sort in JavaScript. Cocktail sort

Bubble sort algorithm doesn鈥檛 track the current state of the array. Even if it gets the fully sorted array as an input, the runtime will remain of the same O(n^2^) complexity....

馃殌 CYBER WEEK SALE: 50% OFF on JavaScript Fundamentals 馃挭

Bubble sort algorithm doesn鈥檛 track the current state of the array. Even if it gets the fully sorted array as an input, the runtime will remain of the same O(n^2^) complexity....

Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order....

All algorithms have 2 main characteristics: Amount of required memory. Execution time. These two are used to compare algorithms with each other. Some algorithms are faster, but require more memory, while others are vice versa....