Sorting algorithms/Quicksort: Difference between revisions

Content added Content deleted
Line 3,511: Line 3,511:
qsort :: Ord a => [a] -> [a]
qsort :: Ord a => [a] -> [a]
qsort [] = []
qsort [] = []
qsort (x:xs) = qsort ys ++ x : qsort zs
qsort (x:xs) = qsort ys ++ [x] ++ qsort zs where
where
(ys, zs) = partition (< x) xs</lang>
(ys, zs) = partition (< x) xs</lang>