Strengthened Lazy Heaps: Surpassing the Lower Bounds for Binary Heaps

Let $n$ denote the number of elements currently in a data structure. An in-place heap is stored in the first $n$ locations of an array, uses $O(1)$ extra space, and supports the operations: minimum, insert, and extract-min. We introduce an in-place heap, for which minimum and insert take $O(1)$ worst-case time, and extract-min takes $O(\lg{} n)$ worst-case time and involves at most $\lg{} n + O(1)$ element comparisons. The achieved bounds are optimal to within additive constant terms for the number of element comparisons. In particular, these bounds for both insert and extract-min -and the time bound for insert- surpass the corresponding lower bounds known for binary heaps, though our data structure is similar. In a binary heap, when viewed as a nearly complete binary tree, every node other than the root obeys the heap property, i.e. the element at a node is not smaller than that at its parent. To surpass the lower bound for extract-min, we reinforce a stronger property at the bottom levels of the heap that the element at any right child is not smaller than that at its left sibling. To surpass the lower bound for insert, we buffer insertions and allow $O(\lg^2{} n)$ nodes to violate heap order in relation to their parents.

[1]  Ingo Wegener The Worst Case Complexity of McDiarmid and Reed's Variant of BOTTOM-UP HEAPSORT is less than nlog n + 1.1n , 1992, Inf. Comput..

[2]  Mark R. Brown,et al.  Implementation and Analysis of Binomial Queue Algorithms , 1978, SIAM J. Comput..

[3]  Jyrki Katajainen The Ultimate Heapsort , 1998, CATS.

[4]  Amr Elmasry,et al.  Layered Heaps , 2004, SWAT.

[5]  Svante Carlsson,et al.  An Optimal Algorithm for Deleting the Root of a Heap , 1991, Inf. Process. Lett..

[6]  Amr Elmasry,et al.  Weak heaps engineered , 2013, J. Discrete Algorithms.

[7]  J. Ian Munro,et al.  An Implicit Binomial Queue with Constant Insertion Time , 1988, SWAT.

[8]  Svante Carlsson,et al.  Heaps with Bits , 1996, Theor. Comput. Sci..

[9]  Ronald D. Dutton,et al.  Weak-heap sort , 1993, BIT.

[10]  Svante Carlsson A Variant of Heapsort with Almost Optimal Number of Comparisons , 1987, Inf. Process. Lett..

[11]  Donald E. Knuth,et al.  Sorting and Searching , 1973 .

[12]  Gaston H. Gonnet,et al.  Heaps on Heaps , 1982, ICALP.

[13]  Jean Vuillemin,et al.  A data structure for manipulating priority queues , 1978, CACM.

[14]  Donald E. Knuth,et al.  The Art of Computer Programming: Volume 3: Sorting and Searching , 1998 .

[15]  Amr Elmasry,et al.  Multipartite priority queues , 2008, TALG.

[16]  Amr Elmasry,et al.  In-place Heap Construction with Optimized Comparisons, Moves, and Cache Misses , 2012, MFCS.

[17]  Bruce A. Reed,et al.  Building Heaps Fast , 1989, J. Algorithms.