Hostname: page-component-cd9895bd7-mkpzs Total loading time: 0 Render date: 2024-12-22T22:18:12.447Z Has data issue: false hasContentIssue false

Simple and efficient purely functional queues and deques

Published online by Cambridge University Press:  07 November 2008

Chris Okasaki
Affiliation:
School of Computer Science, Carnegie Mellon University, 5000 Forbes Avenue, Pittsburgh, PA 15213, USA (e-mail: cokasaki@cs.cmu.edu)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

We present purely functional implementations of queues and double-ended queues (deques) requiring only O(1) time per operation in the worst case. Our algorithms are considerably simpler than previous designs with the same bounds. The inspiration for our approach is the incremental behaviour of certain functions on lazy lists.

Type
Articles
Copyright
Copyright © Cambridge University Press 1995

References

Abelson, H. and Sussman, G. J. (1985) Structure and Interpretation of Computer Programs. MIT Press.Google Scholar
Burton, F. W. (1982) An efficient functional implementation of FIFO queues. Information Processing Letters, 14(5):205206, July.CrossRefGoogle Scholar
Chuang, T.-R. and Goldberg, B. (1993) Real-time deques, multihead Turing machines, and purely functional programming. In: Proceedings of the Conference on Functional Programming and Computer Architecture,Copenhagen, pp. 289298.CrossRefGoogle Scholar
Fischer, P. C., Meyer, A. R. and Rosenberg, A. L. (1972) Real-time simulation of multihead tape units. Journal of the ACM, 19(4):590607, October.CrossRefGoogle Scholar
Gajewska, H. and Tarjan, R. E. (1986) Deques with heap order. Information Processing Letters, 22(4):197200, April.CrossRefGoogle Scholar
Gries, D. (1981) The Science of Programming. Springer-Verlag.CrossRefGoogle Scholar
Hood, R. and Melville, R. (1981) Real-time queue operations in pure Lisp. Information Processing Letters, 13(2):5053, November.CrossRefGoogle Scholar
Hood, R. (1982) The efficient implementation of very-high-level programming language constructs. PhD thesis, Department of Computer Science, Cornell University.Google Scholar
Hoogerwoord, R. R. (1992) A symmetric set of efficient list operations. Journal of Functional Programming, 2(4):505513, October.CrossRefGoogle Scholar
Leong, B. L. and Seiferas, J. I. (1981) New real-time simulations of multihead tape units. Journal of the ACM, 28(1):166180, January.CrossRefGoogle Scholar
Sarnak, N. (1986) Persistent Data Structures. PhD thesis, Department of Computer Sciences, New York University.Google Scholar
Stoß, H.-J. (1970) K-band simulation von k-Kopf-Turing-maschinen. Computing, 6(3):309317.CrossRefGoogle Scholar
Submit a response

Discussions

No Discussions have been published for this article.