This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"word":"pig" | |
}, | |
{ | |
"word":"test" | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) { |