On 3/6/07, Chas Owens <[EMAIL PROTECTED]> wrote:
On 3/6/07, Gary <[EMAIL PROTECTED]> wrote:
> So it sounds like from what you're saying, maybe the structure is a
double-linked list?
> That would give the behaviour you're talking about.
I doubt it is that simple. Remember, random access is generally
considered to be O(1) on arrays and a double-linked list would give
you O(k) when k < n/2 and O(n-k) when k >= n/2. Also, the splices
would be O(1) if it were a double-linked list. Digging through the
perldocs should give you a better idea of the actual implementation,
but in general you can think of it as a contiguous chunk of memory
that can expand in two directions.
After looking at av.c (the implementation of array variables in perl)
I think they are implemented using normal c based arrays. When they
need to grow it looks like realloc gets called to change the memory
allocation. There is probably a lot more going on than just that.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/