summaryrefslogtreecommitdiff
path: root/sort/quicksort.hs
blob: 78330f3ded80ca423b6129b7fcb5e08ff06bf1d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12



quickSort :: Ord a => [a] -> [a]
quickSort [] = []
quickSort (x:xs) =
    let less = [ a | a <- xs, a < x ]
        equal = [ b | b <- (x:xs), b == x ]
        greater = [ c | c <- xs, c > x ]
    in quickSort less ++ equal ++ quickSort greater