AlgoScope

d-ary Heap

Data structureadvancedHeaps

A heap where each node has d children; shallower, cheaper decrease-key, costlier extract.

Decision · step 2 of 6D-ary Heap: Heapify with three children per node
42017132313542651268719899node

Heapify: slot 2 holds 8; its children are slots 7, 8, 9, that is 3 x 2 + 1 onward, holding 3, 19, 9. The smallest child is 3, found with 2 comparisons. 8 is larger, so they swap and the sift continues from slot 7.

Open in the player →or start at step 2

What you will see

Wider tree; sift-down compares against d children.

How d-ary heap works →

Cost

insertO(log_d n)
extract topO(d log_d n)
SpaceO(n)

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, try operations in any order.

Screen readers: Each element is an accessibility element with position, value and state; structural changes are announced per step.

Reduced motion: Elements appear at their destination with a crossfade; no travel longer than the element's own size.

Before this

Related