1998-08-25 08:24:55

by Colin Plumb

[permalink] [raw]
Subject: Re: Skip lists and splay trees

Jamie Lokier ([email protected]) wrote:
> I would definitely recommend a skip list or splay tree. Both are very
> fast. Both are very short code. (_Much_ shorter and simpler than the
> AVL code was).
> The skip list has the advantage that it's fairly simple to code and
> nothing is written (cache advantage).
> The splay tree has the advantage that it automatically caches the
> recently used entries. So much so that there's no need for a one entry
> cache in front of it.

Skip lists have the notable disadvantage that nodes are variable-sized
(due to the random number of pointers in them), which complicates
memory management, a great kernel preoccupation.

Splay trees are amenable to a number of heuristics like self-adjusting
lists, like move-to-front or move-forward-one. They might be worth
playing with a bit.