Skip to content

Instantly share code, notes, and snippets.

@AaronFlower
Created October 31, 2017 03:18
Show Gist options
  • Save AaronFlower/576ab68d094b0f05e6382574674077b2 to your computer and use it in GitHub Desktop.
Save AaronFlower/576ab68d094b0f05e6382574674077b2 to your computer and use it in GitHub Desktop.
quick sort haskell version
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