Skip to content

Instantly share code, notes, and snippets.

@BMU-Verlag
Created August 3, 2020 09:24
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 BMU-Verlag/9c1f64d8cb3a80354f61aa3506636173 to your computer and use it in GitHub Desktop.
Save BMU-Verlag/9c1f64d8cb3a80354f61aa3506636173 to your computer and use it in GitHub Desktop.
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