From 0a48ed023ea65d75851ba2a4151100602695a2fd Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Thu, 22 Oct 2015 14:05:21 +1100 Subject: Cleaning up source a bit --- sort/mergesort.hs | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 sort/mergesort.hs (limited to 'sort/mergesort.hs') diff --git a/sort/mergesort.hs b/sort/mergesort.hs deleted file mode 100644 index 5c140b3..0000000 --- a/sort/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) - - -- cgit