Re: list implementation

2005-07-23 Thread Raymond Hettinger
> > [sj] > >> Thus, random access is an O(1) operation while insertion/deletion is an > >> O(n) operation. [Raymond Hettinger] > > Yes. [Heikki Orsila aka host.invalid] > Unfortunately no. Check Terry Reeds answer. Random access is O(1), > insertion/deletion to front is O(n), and i/d to back is O

Re: list implementation

2005-07-20 Thread Heikki Orsila
Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [sj] >> Thus, random access is an O(1) operation while insertion/deletion is an >> O(n) operation. > Yes. Unfortunately no. Check Terry Reeds answer. Random access is O(1), insertion/deletion to front is O(n), and i/d to back is O(1). The back i/d op

Re: list implementation

2005-07-17 Thread Raymond Hettinger
[sj] > I believe the type "list" is implemented as an array of pointers. Yes. > Thus, random access is an O(1) operation while insertion/deletion is an > O(n) operation. Yes. > 2. Implementing list as an array is part of language specification or > implementation-dependent? Implementation de

Re: list implementation

2005-07-17 Thread Terry Reedy
"sj" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I believe the type "list" is implemented as an array of pointers. A Python list is sematically/behaviorally defined as a mutable extensible sequence of references to Python objects. For the CPython reference implementation, the