Quicksort (Implementation)
(Reading time: under 3 minutes)
We'll cover the following...
First, we create a function that receives the array we want to sort as an argument. It should also be able to get the left and right value. However, as we don’t pass these values at the beginning, it should have a default value as well.
Press + to interact
function quicksort(array, left, right) {left = left || 0;right = right || array.length - 1;}
Next, we need to create a function that chooses the pivot. In this example, I use the ... ...