Title
Heap Construction: Optimal in Both Worst and Average Cases?
Abstract
We investigate the complexity of constructing heaps. The heap construction problem has been extensively studied. However, there was no algorithm for building heaps that is optimal in both the worst and average cases simultaneously. In particular, the worst-case fastest algorithm, proposed by Gonnet and Munro, takes 1.625n comparisons to build an n-element heap (with an average cost of 1.5803n comparisons). The best known average-case upper bound of 1.5212n comparisons was derived by McDiarmid and Reed, which has a worst-case performance of 2n comparisons. Both algorithms require extra space and were conjectured to be optimal respectively in the worst and the average case. In this paper, we design a heap construction algorithm that takes at most 1.625n and 1.500n comparisons in the worst and average cases, respectively. Our algorithm not only improves over the previous best known average-case result by McDiarmid and Reed, but also achieves the best known worst-case upper bound due to Gonnet and Munro. Moreover, we also show that a heap on n elements can be constructed in-situ using at most 1.528n comparisons on average and 2n comparisons in the worst case. This is only 0.007n comparisons more than that of McDiarmid and Reed's algorithm, while the latter needs n bits of extra space.
Year
DOI
Venue
1995
10.1007/BFb0015430
ISAAC
Keywords
Field
DocType
heap construction,average cases,upper bound
Discrete mathematics,Combinatorics,Upper and lower bounds,Average cost,Heap (data structure),Mathematics
Conference
ISBN
Citations 
PageRank 
3-540-60573-8
2
0.42
References 
Authors
15
2
Name
Order
Citations
PageRank
Svante Carlsson176490.17
Jingsen Chen2669.80