comp • gb.data • heap • _new

New Heap (gb.data)

Dim hHeap As Heap
hHeap = New Heap ( Mode As Integer [ , Array As Variant[] ] )

Creates a new Heap.

If Mode is gb.Ascent, it's a MinHeap, i.e. the smallest element is at the beginning. If Mode is gb.Descent, it's a MaxHeap.

If the Array argument is given, a copy of that array is transformed into a Heap, by using a bottom-up algorithm which is O(n).