Overview
A leftist heap stores a heap-ordered binary tree with a null-path-length invariant. Merge recursively combines right spines and swaps children when needed so the right spine stays short.
Maintains a mergeable heap by keeping the shortest null path on the right spine.
Compact metadata for implementation and discovery.
A leftist heap stores a heap-ordered binary tree with a null-path-length invariant. Merge recursively combines right spines and swaps children when needed so the right spine stays short.
Quick facts
Runtime and memory behavior at a glance.
Best
O(1)
Average
O(log n)
Worst
O(n)
Space
O(n)
Show maintaining a null-path-length invariant to merge heaps quickly on a small meldable priority queue example.
Leftist heaps trade array locality for a simple and efficient meld operation.
What each reference supports for this entry.
Data-structures reference for Leftist Heap null-path length ordering and meldable heap operations.
Good next jumps from the relationship graph, ranked for useful discovery.
Leftist heaps store null-path metadata, while skew heaps use self-adjusting swaps.
Both support melding, but maintain different structural invariants.
A leftist heap is a pointer-based priority queue with heap order.