Cascade Heap: Towards Time-Optimal Extractions
Heaps are well-studied fundamental data structures, having myriads of applications, both theoretical and practical.
We consider the problem of designing a heap with an “optimal” extract-min operation. Assuming an arbitrary linear ordering of keys, a heap with n elements typically takes \(O(\log n)\) time to extract the minimum. Extracting all elements faster is impossible as this would violate the \(\varOmega (n \log n)\) bound for comparison-based sorting. It is known, however, that is takes only \(O(n + k \log k)\) time to sort just k smallest elements out of n given, which prompts that there might be a faster heap, whose extract-min performance depends on the number of elements extracted so far.
In this paper we show that is indeed the case. We present a version of heap that performs insert in O(1) time and takes only \(O(\log ^* n + \log k)\) time to carry out the k-th extraction (where \(\log ^*\) denotes the iterated logarithm). All the above bounds are worst-case.
KeywordsIterate Logarithm Regular State Complete Binary Tree Insertion State Binary Heap
- 2.Williams, J.W.J.: Heapsort. Commun. ACM 7, 347–348 (1964)Google Scholar
- 4.Brodal, G.S.: Worst-case efficient priority queues. In: Proceedings of the Seventh Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 1996), pp. 52–58, Philadelphia, PA, USA. Society for Industrial and Applied Mathematics (1996)Google Scholar
- 5.van Emde Boas, P.: Preserving order in a forest in less than logarithmic time. In: Proceedings of the 16th Annual Symposium on Foundations of Computer Science (SFCS 1975), pp. 75–84, Washington, DC, USA. IEEE Computer Society (1975)Google Scholar