Quicksort in haskell

In this article let’s discuss about Quicksort in haskell. Let’s go through the following methods without any delay 🙂

Method 1:

quicksort :: Ord a => [a] -> [a]
quicksort []     = []
quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater)
    where
        lesser  = filter (< p) xs
        greater = filter (>= p) xs

Hope the above methods works for you. Happy Learning and get back to us Anytime.

Realted Posts : Haskell multiline comment