Purely Functional Random-Access Lists (1995)
| Venue: | In Functional Programming Languages and Computer Architecture |
| Citations: | 15 - 2 self |
BibTeX
@INPROCEEDINGS{Okasaki95purelyfunctional,
author = {Chris Okasaki},
title = {Purely Functional Random-Access Lists},
booktitle = {In Functional Programming Languages and Computer Architecture},
year = {1995},
pages = {86--95},
publisher = {ACM Press}
}
OpenURL
Abstract
We present a new data structure, called a random-access list, that supports array lookup and update operations in O(log n) time, while simultaneously providing O(1) time list operations (cons, head, tail). A closer analysis of the array operations improves the bound to O(minfi; log ng) in the worst case and O(log i) in the expected case, where i is the index of the desired element. Empirical evidence suggests that this data structure should be quite efficient in practice. 1 Introduction Lists are the primary data structure in every functional programmer 's toolbox. They are simple, convenient, and usually quite efficient. The main drawback of lists is that accessing the ith element requires O(i) time. In such situations, functional programmers often find themselves longing for the efficient random access of arrays. Unfortunately, arrays can be quite awkward to implement in a functional setting, where previous versions of the array must be available even after an update. Since arra...







