Fibonacci Heap — visual-cs

Lazy consolidation · Cascading cut · Amortized O(1) insert & decrease-key
← All visualizations
Regular node
Min pointer
Marked (will cascade on next decrease-key)
Selected
Newly inserted / just extracted
Fibonacci Heap is a lazy priority queue with amortized O(1) insert, find-min, decrease-key, union; and O(log n) amortized extract-min. It powers the optimal O(E + V log V) Dijkstra. Insert adds a new single-node tree to the root list — no restructuring. Extract-Min removes the min, merges its children into the root list, then consolidates the heap so no two root-list trees have the same degree (link by degree). Decrease-Key cuts the node from its parent if the heap-order is violated, adds it to the root list, and propagates cascading cuts up the ancestry of marked nodes. Mark tracks whether a node has lost a child since it was last made a root — second loss triggers a cascading cut.