Skip to content

Instantly share code, notes, and snippets.

@minhnhdo
Created December 31, 2011 14:33
Show Gist options
  • Save minhnhdo/1544151 to your computer and use it in GitHub Desktop.
Save minhnhdo/1544151 to your computer and use it in GitHub Desktop.
quicksort in haskell
quicksort :: (Ord a) => [a] -> [a]
quicksort [] = []
quicksort (x:xs) = smaller ++ equal ++ greater
where smaller = quicksort (filter (<x) xs)
equal = x:(filter (==x) xs)
greater = quicksort (filter (>x) xs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment