Last active
January 10, 2018 05:23
-
-
Save higuoxing/9d6a8e9818bb72505aca422370f7fe14 to your computer and use it in GitHub Desktop.
quick sort in Haskell
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
quicksort :: (Ord a) => [a] -> [a] | |
quicksort [] = [] | |
quicksort (x : xs) = | |
let smallerSorted = quicksort (filter (<= x) xs) | |
biggerSorted = quicksort (filter (> x) xs) | |
in smallerSorted ++ [x] ++ biggerSorted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment