Implement an algorithm to merge an arbitrary number of sorted lists into one sorted list. The aim is to create the smallest working programme, in whatever language you like.
resubmitted
Python - 74 chars (counting whitespace and newlines)
def m(i):
y=[];x=sum(i,[])
while x:n=min(x);y+=[n];x.remove(n)
return y
i
is input as list of lists
Usage:
>>> m([[1,5],[6,3]])
[1, 3, 5, 6]
Haskell like (158, but more than 24 spaces could be removed.):
mm = foldl1 m where
m [] b = b
m a [] = a
m (a:as) (b:bs)
| a <= b = a : m as (b:bs)
| true = b : m (a:as) bs