Skip to content

Skew Heap

A self-adjusting meldable min-heap that joins heap-ordered binary trees along their right paths and swaps merge-path children without stored balance ranks.

Core Idea

A skew heap is a meldable min-heap made from a heap-ordered binary tree. Its root holds a minimum. To combine two heaps, it merges their right paths and swaps the left and right children of each merge-path node except the lowest. It does this without storing a leftist balance rank.[1]

How would you explain it like I'm…

Smallest-on-Top Card Pile

Imagine a pile of numbered cards arranged like a family tree, where every card is smaller than the cards hanging below it, so the smallest is always on top. To join two piles, you zip them together down one side, swapping left and right sides as you go. Doing that every time keeps the pile quick to use, most of the time.

Swap-and-Merge Heap

A skew heap is a way a computer can store numbers so the smallest one is always easy to grab. The numbers sit in a tree where every parent is no bigger than its children, so the smallest is at the top, called the root. The main job is merging two heaps into one. The computer walks down the right-hand sides of both trees, combining them in order, and swaps the left and right children of the nodes along the way, except the very last one. This swapping keeps merging fast on average over many steps, without storing any extra balance numbers.

Self-Adjusting Meldable Heap

A skew heap is a data structure, designed by Sleator and Tarjan, that keeps the minimum item quickly available and supports merging (melding) two heaps. Items are stored in a heap-ordered binary tree: each parent's key is no greater than its children's, so the root is a minimum. The core operation, meld, combines two heaps by merging along their right paths. Along the merge path, it swaps the left and right children of every node except the lowest one. Unlike a leftist heap, it stores no balance rank; it is self-adjusting instead. Its performance guarantee is amortized, meaning efficient on average over a sequence of operations, not for every single operation.

 

A skew heap, specified by Sleator and Tarjan, is a self-adjusting, meldable min-heap. Items occupy a heap-ordered binary tree — each parent's key is at most its children's keys — so the root holds a minimum. The fundamental update is meld, which combines two disjoint heaps by merging their right paths, and then exchanges the left and right children of each node on the merge path except the lowest. In contrast to a leftist heap, no balance rank is stored; the unconditional child swaps are what make the structure self-adjusting. The original paper gives top-down and bottom-up constructions, which share the heap order and update rule but traverse and assemble the merged path differently, and which have different amortized operation bounds. Neither guarantees logarithmic time for each individual operation; the guarantees are amortized over sequences of operations.

Scope of Application

Sleator and Tarjan specify top-down and bottom-up ways to perform this meld. Both work on disjoint heap instances with ordered keys; insertion can meld a one-item heap, and delete-min can meld the removed root's subtrees. Their proved time bounds are amortized over operation sequences, not guarantees that every call is short.[1]

The original bottom-up delete-min must not be generalized to arbitrary duplicate keys. Jones's original publisher abstract reports that it can discard items in that setting. The corrective versions' details are outside the inspected source base.[2]

Clarity

Ask whether the object has a root minimum, whether it melds two right paths, and whether it exchanges children without consulting a stored rank. Those answers distinguish it from a generic priority-queue interface and from a leftist heap, whose exchange is tied to a maintained rank.[1]

Manages Complexity

The structure avoids maintaining a separate balance rank. That simplifies its meld rule, while the original analysis permits an occasional linear-time operation. The top-down construction has logarithmic amortized insert, delete-min and meld; the bottom-up theorem gives constant amortized insert and meld and logarithmic amortized delete-min under its original assumptions.[1]

Abstract Reasoning

The maintained object, rather than one call to meld, is a Data Structure. It arranges keyed items in a pointer tree, keeps heap order, privileges root-minimum access and composes two heaps by melding them. Its operation profile depends on this arrangement. The sole strict parent edge is child to Data Structure by subsumption/kind_of; arrays and tables can be data structures without being skew heaps. The live generic Heap entry's array/completeness/sift signature does not cover this pointer-linked right-path design.[1]

Knowledge Transfer

The useful comparison is between an explicit shape constraint and a self-adjusting update rule. A skew heap uses the second and is analyzed by the sequence of operations. Transfer that question to other structures without transferring the skew heap's exact proof or duplicate-key assumptions.[1][2]

Example

Top-down original construction: two disjoint heap-ordered trees are the inputs. The meld walks downward along their right paths, combines path nodes in key order, and swaps children except at the lowest node without using a balance rank. Singleton meld implements insert; subtree meld implements delete-min. Theorem 1 gives logarithmic amortized insert, delete-min and meld, with constant-time make-heap and find-min. This is a formal construction, not a measured deployment.[1]

Bottom-up original construction: two disjoint heap-ordered trees again supply the inputs. The meld walks upward along right paths and assembles the merged path with root reattachment; it uses the same rank-free exchange exception. Theorem 2 gives constant amortized insert and meld and logarithmic amortized delete-min in the original domain. This traversal and cost profile differ from top-down. Keep the distinct-key limit because Jones reports a duplicate-key delete-min failure in the published bottom-up procedure.[1][2]

Relationships to Other Abstractions

Local relationship map for Skew HeapParents appear above the current abstraction, mutual partners to the right, and children below. Node labels state whether each abstraction is prime or domain-specific; colors identify relation types.Skew HeapDOMAINPrime abstraction: Data Structure — is a kind ofData StructurePRIME

Current abstraction Skew Heap Domain-specific

Parents (1) — outgoing typed relations

  • Skew Heap is a kind of Data Structure Prime

    A skew heap is a maintained arrangement of keyed items with heap order, root-minimum access and composable meld operations.

Hierarchy path (1) — routes to 1 parentless root

Neighborhood in Abstraction Space

Skew Heap sits in a sparse region of the domain-specific corpus (85th percentile for distinctiveness): few abstractions share its structure, so a faithful description tends to retrieve it precisely.

Family — Unclustered & Miscellaneous (3155 abstractions)

Nearest neighbors

Computed from structural-signature embeddings · 2026-11-14

Not to Be Confused With

A complete-array binary heap maintains a different layout and updates by sifting. A leftist heap stores a rank and swaps conditionally. A bare priority queue says what operations are wanted but not how this tree melds. Also, neither the top-down logarithmic nor bottom-up constant amortized bounds are per-operation worst-case promises, and the lowest merge-path node is exempt from exchange.[1]

References

[1] Sleator, Daniel D., and Robert E. Tarjan (1986). Self-Adjusting Heaps. SIAM Journal on Computing 15(1), 52–69. DOI: 10.1137/0215004. Original full article, especially §§2–3, Figs. 1 and 5, Theorems 1 and 2, printed pp.53–63. registry ↩a ↩b ↩c ↩d ↩e ↩f ↩g ↩h ↩i

[2] Jones, Douglas W. (1987). A Note on Bottom-Up Skew Heaps. SIAM Journal on Computing 16(1), 108–110. DOI: 10.1137/0216009. Publisher abstract only supports the duplicate-key limitation; no full-text correction procedure is claimed. registry ↩a ↩b ↩c