Copyright | © Frank Jung 2019 |
---|---|
License | GPL-3 |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Qsort
Description
A simple implementation of Qsort.
From "Programming in Haskell" by Graham Hutton.
>>>
qsort [3,5,1,2,4,2]
[1,2,2,3,4,5]
If a <= x
is replaced with a < x
, then only unique values are reported.
>>>
qsort' [3,5,1,2,4,2]
[1,2,3,4,5]
To reverse sort, switch smaller and larger in qsort
.
>>>
qsort'' [3,5,1,2,4,2]
[5,4,3,2,2,1]