โ† Back to the heaps page

D-ary, Indexed & Mergeable Heaps

Engineering variants: wider nodes (d-ary), position tracking for decrease-key (indexed), and heaps that merge in O(log n) (pairing, Fibonacci).

What to know

  • D-ary heaps trade deeper sift-downs for shallower trees โ€” 4-ary often wins in practice for Dijkstra.
  • Indexed priority queues map item โ†’ heap position so priorities can be updated in place.
  • Fibonacci heaps give O(1) amortized decrease-key (theory); pairing heaps win in practice.

In the wild: Network routing daemons, simulation engines merging event queues, game AI planners.

Algorithms to reach for

Dijkstra with decrease-key

O(E + V log V) w/ Fib

Update tentative distances in place

Pairing-heap meld

O(1) amortized

Merge two priority queues cheaply

D-ary sift tuning

O(log_d n) per op

Cache-tuned priority queues

Practice problems โ€” with full guides

Each problem has its own page: progressive hints, how to approach it, and the full solution.