Skip to content

Files

Latest commit

 

History

History
18 lines (12 loc) · 1.1 KB

README.md

File metadata and controls

18 lines (12 loc) · 1.1 KB

heap GoDoc

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 example: insert gif

Implicit Heap Implementation

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 intand values can be any type interface{}.

For best performance use a small non sparsed Key value distribution. (100-300 incremental values).