Program Base Library

pblHeap - Binary Min Max Heap Implementation

Documentation

This heap orders elements according to a compare function specified. A heap does not permit null elements.

The head of this heap is the biggest element according to the compare function specified.
If multiple elements are tied for highest priority,
the head is one of those elements -- ties are broken arbitrarily.
The heap retrieval operations pblHeapGet and pblHeapRemoveFirst access the element at the head of the heap.

A heap is unbounded, but has an internal capacity governing the size of an array used to store the elements on the heap.
It is always at least as large as the heap size.
As elements are added to a heap, its capacity grows automatically.
The details of the growth policy are not specified.

The Iterator provided in method pblHeapIterator() is not guaranteed to traverse the elements of the
Heap in any particular order.

Implementation note: this implementation provides O(log(n)) time for the insertion methods;
O(log(n)) time for the removal methods; and constant time for the retrieval methods.