Sort one sequence by O(n) in time and O(1) in space

Sturla Molden sturla.molden at
Mon Feb 10 16:03:25 CET 2014

Chris Angelico <rosuav at> wrote:

> That's assuming it really is a sort operation. The problem description
> isn't entirely clear on this point, but if it's actually a zip, then
> it can definitely be done in O(n).

Ah, I didn't read it carefully enough. :-)

Granted, a zip can be done in O(n) time and O(1) memory using a generator,
which by the way is what itertools.izip does.


More information about the Python-list mailing list