Skip to content

Instantly share code, notes, and snippets.

@abusque
Created May 23, 2011 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abusque/986185 to your computer and use it in GitHub Desktop.
Save abusque/986185 to your computer and use it in GitHub Desktop.
Quicksort haskell
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