c question

Joerg Sonnenberger joerg at britannica.bec.de
Fri Apr 23 15:41:33 UTC 2010


On Fri, Apr 23, 2010 at 06:18:46PM +0300, Eitan Adler wrote:
> > - use a matrix is faster than use a linked list?
> 
> For what?
> For insertion and deletion no - linked list is faster. For sequential
> access they are the same speed (forgetting look-ahead caching). For
> random access matrix is faster.

Actually -- it depends. Removing the tail and inserting at tail is
amortised constant time for arrays if done using the double-on-full
trick. In that case, array can be the faster datastructure too.

Joerg


More information about the freebsd-hackers mailing list