d-ary heap (source code)

= d-ary heap
{wiki}

A <heap data structure> stored as a complete rooted tree with up to $d$ children per <vertex>, where $d\geq2$. The final level is filled from left to right. For zero-based <array> storage, the parent of entry $i>0$ is $\lfloor(i-1)/d\rfloor$, and its child number $j\in\{0,\ldots,d-1\}$ has index $di+j+1$ when that index is inside the active heap. There are at most $O(1+\log_d n)$ levels containing $n$ entries.