Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
README.md
benchmark.log
heap.go
implicit_heap.go
implicit_heap_benchmark_test.go
implicit_heap_examples_test.go
implicit_heap_max.go
implicit_heap_max_test.go
implicit_heap_min.go
implicit_heap_min_test.go

README.md

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).