Function to merge sorted lists
John W. Baxter
jwbaxter at spamcop.com
Fri Aug 31 11:02:49 EDT 2001
In article <3B8EE66C.2090703 at erols.com>, Edward C. Jones
<edcjones at erols.com> wrote:
> Has anyone written in C a merge function for sorted Python sequences? It
> should look like:
> merged_list, tail1, tail2 = merge(list1, list2)
> where either tail1 or tail2 is []. Suppose tail1 is []. Then tail2 is a
> terminal sublist of list2, the last element of merged_list is the last
> element of list1, and merged_list + tail2 is the merger of list1 and
> list2. Similarly if tail2 is [].
>
> This function would be useful for writing external merge sort programs.
>
Ah, back to the good old days of the 8 tape sort (the showing of which
was the movie idiom for "computer" in the 1950s). ;-)
--John
More information about the Python-list
mailing list