Classical FP problem in python : Hamming problem

Paul Rubin http
Fri Jan 28 02:27:48 EST 2005

Francis Girard <francis.girard at> writes:
> Thank you Nick and Steven for the idea of a more generic imerge.

If you want to get fancy, the merge should use a priority queue (like
in the heapsort algorithm) instead of a linear scan through the
incoming iters, to find the next item to output.  That lowers the
running time to O(n log k) instead of O(n*k), where k is the number of
iterators and n is the length.

More information about the Python-list mailing list