summaryrefslogtreecommitdiff
path: root/sort/strandsort.hs
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2015-10-22 14:05:21 +1100
committerJed Barber <jjbarber@y7mail.com>2015-10-22 14:05:21 +1100
commit0a48ed023ea65d75851ba2a4151100602695a2fd (patch)
treed3e5b41e148475d5d7aeca164a9ebc8bc99becdd /sort/strandsort.hs
parent7dbbe1156c9489151dca6760b1021db426caf84e (diff)
Cleaning up source a bit
Diffstat (limited to 'sort/strandsort.hs')
-rw-r--r--sort/strandsort.hs25
1 files changed, 0 insertions, 25 deletions
diff --git a/sort/strandsort.hs b/sort/strandsort.hs
deleted file mode 100644
index 8226b79..0000000
--- a/sort/strandsort.hs
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-strandSort :: Ord a => [a] -> [a]
-strandSort list = doStrandSort list [] [] []
-
-
-
-doStrandSort :: Ord a => [a] -> [a] -> [a] -> [a] -> [a]
-doStrandSort [] [] [] result = result
-doStrandSort [] sublist unsorted result = doStrandSort unsorted [] [] (merge (reverse sublist) result)
-doStrandSort input [] unsorted result = doStrandSort (tail input) [head input] unsorted result
-doStrandSort input sublist unsorted result =
- if (head input) >= (head sublist)
- then doStrandSort (tail input) ((head input):sublist) unsorted result
- else doStrandSort (tail input) sublist ((head input):unsorted) result
-
-
-
-merge :: Ord a => [a] -> [a] -> [a]
-merge [] y = y
-merge x [] = x
-merge (x:xs) (y:ys) = if x <= y then x:(merge xs (y:ys)) else y:(merge (x:xs) ys)
-
-