List insertion cost

Daniel Stutzbach daniel at
Tue Jul 21 15:35:55 EDT 2009

On Tue, Jul 21, 2009 at 2:21 PM, Lucas P Melo <lukepadawan at> wrote:

> I would like to know how much it costs to insert an element into a list
> using this operation:
> a[2:2] = [ 1 ]
> i. e, what is the complexity of the operation above (given that len(a) =
> n)?


If you want O(log n), you can use the blist extension type from

Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list