Why it matters

Leftist heaps enable efficient merge. Understanding shapes functional PQ.

Advertisement

The architecture

Binary tree with s-value (null path length).

Left child's s-value >= right's.

Merge along right spine.

Leftist heapLeft-heavy trees-value invariantMergealong right spineInsert / Extractvia mergeSimpler than Fibonacci; often used in functional / persistent contexts
Leftist.
Advertisement

How it works end to end

Merge: recursively merge right spines.

Insert = merge with singleton.

Extract-min = merge children.

All ops O(log n).