Hacker News new | past | comments | ask | show | jobs | submit login

quicksort [] = []

quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater)

    where

        lesser = filter (< p) xs

        greater = filter (>= p) xs



Keep in mind that this algorithm is not in-place, so it wouldn't be fair to say that it's more 'elegant' than imperative quicksort implementations.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: