A collection of basic abstract heap data structures.
Implicit Heap description example
Dynamic Min & Max Implicit heaps.
An implicit heap is an implementation of a heap consisting of a complete binary tree whose nodes contain the heap items, one node per item.
Insert (push) and remove min/max (pop) have O(log n)
complexity. The size of the slices (array) is dynamic, with a minimum of 8 elements and doubles each time is full, and shrink to half each time it's N < size/4
.
The keys are int
and values can be any type interface{}
.
For best performance use a small non sparsed Key value distribution. (100-300 incremental values).