summaryrefslogtreecommitdiff
path: root/sort/quick.hs
diff options
context:
space:
mode:
Diffstat (limited to 'sort/quick.hs')
-rw-r--r--sort/quick.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/sort/quick.hs b/sort/quick.hs
new file mode 100644
index 0000000..44efd81
--- /dev/null
+++ b/sort/quick.hs
@@ -0,0 +1,15 @@
+module Quick (
+ quickSort
+ ) where
+
+
+
+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
+
+