Adaptive Fibonacci and Pairing Heaps
1 Introduction
In this brief note, we present two adaptive heaps. See [4] and [5] for discussion of adaptive heaps. The first structure is a modification of the Fibonacci heap [3]. The second, a relaxation of the Fibonacci like structure which is similar to a pairing heap [2]. While the specification of the data structures is complete, the analysis is not. We welcome interested parties to complete it.
2 Adaptive Fibonacci Heap
For ease of comparison, our structure mirrors that of CLRS Chapter 19 [1]. We include one additional pointer at the top level pointing to the first element added to the root list.
2.1 Operations
INSERT, FIND-MIN, UNION, and DECREASE-KEY are identical to CLRS 19 and have amortized cost using the same potential function.
The entire difference is in how we build our trees during the EXTRACT-MIN operation. We add adaptivity to presorted input. We only need to modify the CONSOLIDATE operation of CLRS 19.2. For completeness, we include the EXTRACT-MIN code from 19.2. When we iterate over lists, we assume the iteration proceeds from the first element added to the list to the last element added to the list (oldest to newest).
2.2 Example
Say we insert the random sequence
into our heap and then call EXTRACT-MIN. EXTRACT-MIN removes and consolidates the remaining nodes. Note: the “else if ” statement in APPEND causes with . These nodes are darkened in the example. The “if ” statement ensures a darkened node is not given an additional child.
(a) ![]() |
(b) ![]() |
(c) ![]() |
(d) ![]() |
(e) ![]() |
(f) ![]() |
(g) ![]() |
(h) ![]() |
(i) ![]() |
(j) ![]() |
(k) ![]() |
(l) ![]() |
(m) ![]() |
(n) ![]() |
Lemma 1.
Let be any node in the heap, and . Let denote the children of in the order in which they were linked to , from earliest to latest. Then and for .
Proof.
Clearly . For , we note that when was linked to , all were children of , and so we must have had . Let . We first show that when linked, . There are only two ways in which could have become a child of in CONSOLIDATE.
-
1.
If , , and we call APPEND. Then .
-
2.
If , , , and we call APPEND. Then or .
Thus, . Since was linked, it has lost at most one child, since it would have been cut by CASCADING-CUT if it had lost two children. We conclude that . ∎
With Lemma 1, the remaining propositions can be proved nearly identically to CLRS.
Corollary 1.1.
The maximum degree of all nodes is .
Theorem 2.
EXTRACT-MIN runs in amortized time.
Theorem 3.
DECREASE-KEY runs in amortized time.
We would like to have some dynamic optimality result like this:
Conjecture 1.
The above heap is competitive with all comparison based heaps that have an amortized decrease key.
3 Pairing Like Heap
3.1 Structure
Use the same structure as used above except we do not need to store degree information in each node.
Two nice things about this structure. One, it makes the locally optimal choice of only leaving local min in the root list. Two, starting from a list of degree 0 nodes, the degree of any node in the final tree is . Thus, it has better structural properties than the standard pairing heap.
3.2 Operations
Again, operations are the same as for Fibonacci heap presented in CLRS 19 except for the CONSOLIDATE procedure in EXTRACT-MIN. The CONSOLIDATE code uses pointers for previous, for current and travels in loops around the circularly linked root list until only one root remains. A of CONSOLIDATE is one loop from beginning to end of root list.
Lemma 4.
Let be the root list after the cycle of CONSOLIDATE. Then contains the local minimum of .
Lemma 5.
Let be the number of roots in ’s root list prior to CONSOLIDATE. The increase in degree of any node caused by CONSOLIDATE is less than .
Conjecture 2.
The degree of any node in is .
Conjecture 3.
DECREASE-KEY runs in amortized time. EXTRACT-MIN runs in amortized time.
Conjecture 4.
Let be a sequence of numbers, be the subsequence of local minimums in in the order in which they appear in , and be the local minimums in in the order they appear in . Say and . Then a comparison sort is dynamically optimal if and only if it sorts every list in
Again, something about optimality, although statement of this conjecture depends on Conjecture 3.
Conjecture 5.
The above heap is competitive with all comparison based heaps that have an amortized decrease key.
3.3 Example
Say we insert the same random sequence
into this heap and then call EXTRACT-MIN. EXTRACT-MIN removes and consolidates the remaining nodes. The resulting structure is presented below.

References
- [1] Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Introduction to Algorithms, Third Edition. The MIT Press, 3rd edition, 2009.
- [2] Michael Fredman, Robert Sedgewick, Daniel Sleator, and Robert Tarjan. The pairing heap: A new form of self-adjusting heap. Algorithmica, 1:111–129, 11 1986.
- [3] Michael L. Fredman and Robert Endre Tarjan. Fibonacci heaps and their uses in improved network optimization algorithms. J. ACM, 34(3):596–615, July 1987.
- [4] Andrew Frohmader. List heaps. CoRR, abs/1802.05662, 2018.
- [5] László Kozma and Thatchaphol Saranurak. Smooth heaps and a dual view of self-adjusting data structures. In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2018, page 801–814, New York, NY, USA, 2018. Association for Computing Machinery.