SIAM Journal on Computing
A variant of Heapsort with almost optimal number of comparisons
Information Processing Letters
Journal of Algorithms
Information and Computation
MFCS '90 Selected papers of the 15th international symposium on Mathematical foundations of computer science
A data structure for manipulating priority queues
Communications of the ACM
Communications of the ACM
Performance engineering case study: heap construction
Journal of Experimental Algorithmics (JEA)
A Framework for Constructing Heap-Like Structures In-Place
ISAAC '93 Proceedings of the 4th International Symposium on Algorithms and Computation
FOCS '99 Proceedings of the 40th Annual Symposium on Foundations of Computer Science
Navigation piles with applications to sorting, priority queues, and priority deques
Nordic Journal of Computing
Introduction to Algorithms, Third Edition
Introduction to Algorithms, Third Edition
WADS'05 Proceedings of the 9th international conference on Algorithms and Data Structures
Journal of Discrete Algorithms
Hi-index | 0.00 |
We show how to build a binary heap in-place in linear time by performing ˜ 1.625n element comparisons, at most ˜ 2.125n element moves, and ˜ n/B cache misses, where n is the size of the input array, B the capacity of the cache line, and ˜ f(n) approaches f(n) as n grows. The same bound for element comparisons was derived and conjectured to be optimal by Gonnet and Munro; however, their procedure requires Θ(n) pointers and does not have optimal cache behaviour. Our main idea is to mimic the Gonnet-Munro algorithm by converting a navigation pile into a binary heap. To construct a binary heap in-place, we use this algorithm to build bottom heaps of size $\Theta(\lg n)$ and adjust the heap order at the upper levels using Floyd's sift-down procedure. On another frontier, we compare different heap-construction alternatives in practice.