Hpw make lists that are easy to sort.

Anton Vredegoor anton.vredegoor at gmail.com
Wed Mar 28 19:37:20 EDT 2007


Terry Reedy wrote:

> One could generate the items in order in less space by doing, for instance, 
> an m-way merge, in which only the lowest member of each of the m sublists 
> is present at any one time.  But I don't know if this (which is 
> O(m*n*log(m))) would be any faster (in some Python implementation) for any 
> particular values of m and m.

If hashing is O(n+m), it would mean that it would be faster.

I'm not sure if I can agree with your analysis. All information to 
generate the product is already inside the two lists we begin with. 
Doesn't that make the product less complex than a random n*m matrix? Or 
is that what you are saying with O(m*n*log(m)) ?

A.



More information about the Python-list mailing list