Guido rethinking removal of cmp from sort method

Paul Rubin no.email at nospam.invalid
Thu Mar 24 03:40:03 EDT 2011


Dennis Lee Bieber <wlfraed at ix.netcom.com> writes:
> 	The first half of the problem description -- "Elements are added at
> random" seems more suited to an in-place insertion sort method. 

This is precisely what a priority queue is for.  Insertions take 
O(log n) time and there's very little space overhead in heapq's
list-based implementation.



More information about the Python-list mailing list