Skip to content

Instantly share code, notes, and snippets.

[
{
"word":"pig"
},
{
"word":"test"
}
]
// Find a "pivot" element in the array to compare all other
// elements against and then shift elements before or after
// pivot depending on their values
const qucikSort = (arr, left = 0, right = arr.length - 1) => {
if (arr.length > 1) {
const index = partition(arr, left, right)
if (left < index - 1) {
qucikSort(arr, left, index - 1)
}
if (index < right) {