Which is a more efficient implementation of a linked list?
<p>There are at least two ways to represent a linked list:</p>

<p>1.)Using an array based representations of the linked list, where
   we keep an <code>std::vector</code> of structs of the type</p>

<pre><code>struct {
    &lt;whatever-type-you-want&gt; item ;
     int   nextitem; 
   }
</code></pre>

<p>Here inserting into the list, is doing a push_back() on the vector and giving
an appropriate value to next-item. </p>

<p>2) In which you
have a collection of structs all over RAM. Here insert is done with 
the C++ operators <code>new</code> .</p>

<p>Is it correct to say, that the first method is more efficient since all the items are in consecutive locations in memory, because of which one might be able to grow the linked list
to a much larger size than the second method</p>

<p>In the second method, there might be memory fragmentation with huge linked lists because of which one might get a segmentation fault much earlier.</p>
