diff options
author | Jed Barber <jjbarber@y7mail.com> | 2015-10-17 14:20:48 +1100 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2015-10-17 14:20:48 +1100 |
commit | 63c3043200de6b28a8c192f1b5625940435ea55e (patch) | |
tree | ab761edbbc71b2b2f28e0ef7e10b8adc58d44320 /mergesort.hs | |
parent | 5933f248c18914fbbce03102b340361a575eae3c (diff) |
Organised source code a bit, added makefile with clean target
Diffstat (limited to 'mergesort.hs')
-rw-r--r-- | mergesort.hs | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/mergesort.hs b/mergesort.hs deleted file mode 100644 index 5c140b3..0000000 --- a/mergesort.hs +++ /dev/null @@ -1,19 +0,0 @@ - - - -mergeSort :: Ord a => [a] -> [a] -mergeSort x | length x <= 1 = x -mergeSort x = - let n = (length x) `div` 2 - left = mergeSort (take n x) - right = mergeSort (drop n x) - in merge left right - - - -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) - - |