Created
July 2, 2019 14:40
-
-
Save verdi327/3e3ca53578264f0c0fd665b0e9659a0c to your computer and use it in GitHub Desktop.
quick-sort
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
function quickSort(arr, start=0, end=arr.length) { | |
if (start >= end) { | |
return arr; | |
} | |
let pivot = partition(arr, start, end); | |
arr = quickSort(arr, start, pivot); | |
arr = quickSort(arr, pivot+1, end); | |
return arr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment