Optimal purely functional priority queues
- 1 January 1996
- journal article
- research article
- Published by Cambridge University Press (CUP) in Journal of Functional Programming
- Vol. 6 (6) , 839-857
- https://doi.org/10.1017/s095679680000201x
Abstract
Brodal recently introduced the first implementation of imperative priority queues to supportfindMin, insertandmeldinO(1) worst-case time, anddeleteMininO(logn) worst-case time. These bounds are asymptotically optimal among all comparison-based priority queues. In this paper, we adapt Brodal's data structure to a purely functional setting. In doing so, we both simplify the data structure and clarify its relationship to the binomial queues of Vuillemin, which support all four operations inO(logn) time. Specifically, we derive our implementation from binomial queues in three steps: first, we reduce the running time ofinserttoO(1) by eliminating the possibility of cascading links; second, we reduce the running time offindMintoO(1) by adding a global root to hold the minimum element; and finally, we reduce the running time ofmeldtoO(1) by allowing priority queues to contain other priority queues. Each of these steps is expressed using ML-style functors. The last transformation, known as data-structural bootstrapping, is an interesting application of higher-order functors and recursive structures.Keywords
This publication has 22 references indexed in Scilit:
- Confluently Persistent Deques via Data-Structural BootstrappingJournal of Algorithms, 1995
- Simple and efficient purely functional queues and dequesJournal of Functional Programming, 1995
- Report on the programming language HaskellACM SIGPLAN Notices, 1992
- Fibonacci heaps and their uses in improved network optimization algorithmsJournal of the ACM, 1987
- The pairing heap: A new form of self-adjusting heapAlgorithmica, 1986
- An empirical comparison of priority-queue and event-set implementationsCommunications of the ACM, 1986
- Self-adjusting binary search treesJournal of the ACM, 1985
- An applicative random-access stackInformation Processing Letters, 1983
- A data structure for manipulating priority queuesCommunications of the ACM, 1978
- AlgorithmsCommunications of the ACM, 1964