Skip to content

Instantly share code, notes, and snippets.

@ClausPolanka
Created October 14, 2010 14:01
Show Gist options
  • Save ClausPolanka/626208 to your computer and use it in GitHub Desktop.
Save ClausPolanka/626208 to your computer and use it in GitHub Desktop.
Quicksort in 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