Module gamejs/utils/binaryheap

Class BinaryHeap

Instance Methods


BinaryHeap (scoreFunction)

Binary Heap

Parameters

scoreFunction

See

http://eloquentjavascript.net/appendix2.html

BinaryHeap.prototype.pop (element)

Return first element from heap.

Parameters

Object element

Returns

Object element

BinaryHeap.prototype.push (element)

Add element to heap.

Parameters

Object element

BinaryHeap.prototype.remove (element)

Remove the given element from the heap.

Parameters

Object element

Throws

{Error} if node not found

BinaryHeap.prototype.size ()

Number of elements in heap.