A binary heap answers insert, find-min, and delete-min in — good enough for most jobs. But what if the keys are integers drawn from a bounded universe ? That extra structure is a gift: Peter van Emde Boas showed in 1977 that you can support every priority-queue operation in time, regardless of how many elements you hold.
That is not a misprint. If — the range of a 64-bit integer — then . Any predecessor query, any insert, any delete, finishes in at most six recursive steps.
The secret is a recursive galaxy of clusters. Split the universe in half at each level: a root structure holds a summary of which clusters are non-empty, and each cluster recurses on a universe of size . Because , every level of recursion halves the exponent — and you need only levels before the universe is trivially small.
Comments
Loading comments...