Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
quicksort :: Ord a => [a] -> [a]
quicksort [] = []
quicksort (x:xs) = quicksort teil1 ++ [x] ++ quicksort teil2
where
teil1 = [y | y <- xs, y <= x]
teil2 = [y | y <- xs, y > x]
main = print (quicksort [9, 7, 4, 11, 13, 15, 2, 8])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment