Pushing the Information-Theoretic Limits of Random Access Lists: Traversing Cons Lists in (1 + 1/๐ ) โlg ๐โ + ๐ + 9 Steps
Abstract
Accessing an arbitrary element of a singly linked list or cons list requires traversing up to a linear number of pointers. The applicative random-access list is a data structure that behaves like a cons list except that accessing an arbitrary element traverses only a logarithmic number of pointers. Specifically, in a list of length n, an arbitrary element can be accessed by traversing at most 3โlgnโโ5 pointers.
In this paper, we present a simple variation on random-access lists that improves this bound and requires traversing at most 2โlg(n+1)โโ 3 pointers. We then present a more complicated variation that improves this bound to (1+1/ฯ)โlgnโ+ฯ+9 for any ฯโฅ 1. This shows that it is possible to get asymptotically close to the information-theoretically optimal bound of โlg(n+1)โโ1.