Last active
February 13, 2019 16:51
-
-
Save quisido/40c6a9651cac6f27d5778f34cea111ba to your computer and use it in GitHub Desktop.
Implementing Quicksort in JavaScript
This file contains hidden or 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
| const defaultComparator = (a, b) => { | |
| if (a < b) { | |
| return -1; | |
| } | |
| if (a > b) { | |
| return 1; | |
| } | |
| return 0; | |
| }; | |
| const quickSort = ( | |
| unsortedArray, | |
| comparator = defaultComparator | |
| ) => { | |
| const sortedArray = TODO(unsortedArray); | |
| return sortedArray; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment