Merging multiple sorted sequences.

Erik python at lucidity.plus.com
Wed Apr 12 19:15:47 EDT 2017


Hi Peter,

On 12/04/17 23:42, Peter Otten wrote:
> Erik wrote:
>
>> I need to be able to lazily merge a variable number of already-sorted(*)
>> variable-length sequences into a single sorted sequence.
>
> https://docs.python.org/dev/library/heapq.html#heapq.merge

AFAICT (looking at the Python 3.5 heapq implementation, albeit very 
briefly), it seems like that is a greedy algorithm. Am I missing something?

Thanks, E.


More information about the Python-list mailing list