[Haskell-cafe] Clarification Please

Krzysztof Kościuszkiewicz k.kosciuszkiewicz at gmail.com
Thu Sep 13 23:36:00 EDT 2007


On Fri, Sep 14, 2007 at 03:45:02AM +0100, PR Stanley wrote:

> 5. Using merge, define a recursive function
> msort :: (Ord a) => [a] -> [a]
> that implements merge sort, in which the empty 
> list and singleton lists are already sorted, and 
> any other list is sorted by merging together the 
> two lists that result from sorting the two halves of the list separately. :
> Hint: first define a function
> ¬halve :: [a] -> [([a], [a])]
> ¬that splits a list into two halves whose length differs by at most one.

Split the input list using halve, sort both halves (as merge requires lists to
be sorted) and merge them into output list...

Regards,
-- 
Krzysztof Kościuszkiewicz
Skype: dr.vee,  Gadu: 111851,  Jabber: kokr at jabberpl.org
Mobile IRL: +353851383329,  Mobile PL: +48783303040
"Simplicity is the ultimate sophistication" -- Leonardo da Vinci


More information about the Haskell-Cafe mailing list