Best way to merge/sort two sorted lists?...

Neil Cerutti horpner at yahoo.com
Thu Dec 6 14:14:29 EST 2007


On 2007-12-06, Raymond Hettinger <python at rcn.com> wrote:
> On Dec 6, 9:30 am, Aaron Watters <aaron.watt... at gmail.com> wrote:
>
>> While trying to optimize some NUCULAR libraries I discovered
>> that the best way to merge 2 sorted lists together
>> into a new sorted list is to just append
>> them and re-sort.
>  . . .
>> I'm beginning to think
>> a "sorted list merger" might make a nice tiny extension module
>> (at least for my purposes).
>
>
> See recipes:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/491285
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305269

That's fairly awesome.

-- 
Neil Cerutti



More information about the Python-list mailing list