array, list, performance...

Steve Holden sholden at holdenweb.com
Thu Jun 6 10:20:10 EDT 2002


"Christopher Armstrong" <radix at twistedmatrix.com> wrote in message
news:mailman.1023373030.31871.python-list at python.org...
>
> > Michael Chermside <mcherm at destiny.com> writes::
> >   li[n] = x      assignment to the middle is O(len(li))
>
> This doesn't seem right. Shouldn't that be O(1), just like
> access-time?
>

(I should have specifically said I was talking about INSERTION. You are
correct about assignment over an existing element).

--
-----------------------------------------------------------------------
Steve Holden                                 http://www.holdenweb.com/
Python Web Programming                http://pydish.holdenweb.com/pwp/
-----------------------------------------------------------------------








More information about the Python-list mailing list