Brian Candler wrote in post #969420: > Emil Macarie wrote in post #969413: >> I do see the Array class has an insert method, however assuming that >> the implementation of an Array is actually a contiguous array in memory, >> the insert method will create a new copy of an array with the insert >> element appended. > > Nope. It grows the memory space, and shuffles the existing elements if > necessary (if you're inserting into the middle rather than at the end). > > I believe it also grows the memory space by more than is needed, so that > 10,000 inserts don't require 10,000 grows. > >> If that is the case how should I (starting with 0 elementS) append and >> create a large linked list ? > > Just append to an empty Array. And relax :-) Thanks ! That does make me feel better about using an array as a list for now. I will have to take a look at the source code as I am curious it all works. As for relaxing, I do try :), but the amount of times I've seen people make these kinds of mistakes has made me rather thin skinned. -- Posted via http://www.ruby-forum.com/.