FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GitHub Viewer

/** * @function QuickSort * @description Quick sort is a comparison sorting algorithm that uses a divide and conquer strategy. * @param {Integer[]} items - Array of integers * @return {Integer[]} - Sorted array. * @see [QuickSort](https://en.wikipedia.org/wiki/Quicksort) */ function quickSort (items) { const length = items.length if (length PIVOT) { GREATER.push(items[i]) } else { LESSER.push(items[i]) } } const sorted = [...quickSort(LESSER), PIVOT, ...quickSort(GREATER)] return sorted } export { quickSort }

Back | FazBrowse Home | New Git URL