Optimized bubble sort in JavaScript. Cocktail sort

Bubble sort algorithm doesn’t 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. Read more

Similar

JavaScript const

const in JavaScript Topics covered in this video: * What is const (constants)? * What they are used for? * The let keyword behavior vs the const keyword beha... (more…)

Read more »