Created
December 2, 2018 04:04
-
-
Save pwxcoo/955d67a6a60d6a2fbdd72b0b1d7b9aed 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 [a | a <- xs, a <= x] | |
biggerSorted = quicksort [a | a <- xs, a > x] | |
in smallerSorted ++ [x] ++ biggerSorted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment