Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Apr 2010 17:40:12 +0200
From:      Joerg Sonnenberger <joerg@britannica.bec.de>
To:        freebsd-hackers@freebsd.org
Subject:   Re: c question
Message-ID:  <20100423154012.GA10560@britannica.bec.de>
In-Reply-To: <i2za0777e081004230818y9008c7b7yc574298df85933dc@mail.gmail.com>
References:  <l2ga2585ef1004090709u821fc979i226a3125d9da8251@mail.gmail.com> <i2za0777e081004230818y9008c7b7yc574298df85933dc@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100423154012.GA10560>