for each file
read the first number into a sorted list
end loop
while the list is non empty and the files have more items
write the first item in the sorted list to the output
if the item's file has more
read next item from file into sorted list
end if
end loop