Heap instance constructor.
Optional comparison function, defaults to Heap.minComparator
Optional comparison function, defaults to Heap.minComparator
Alias of peek
Alias of add
Alias of pop
Alias of clear
Remove all of the elements from this heap.
Length of the heap. Aliases: size.
Set length limit of the heap. Same as using setLimit.
Limit, defaults to 0 (no limit). Negative, Infinity, or NaN values set the limit to 0.
Returns the comparison function.
Get the leafs of the tree (no children nodes). See also: getChildrenOf and bottom.
Set length limit of the heap. Same as assigning to limit but returns NaN if the value was invalid.
Limit. Negative, Infinity, or NaN values set the limit to 0.
The limit or NaN if the value was negative, or NaN.
Static
defaultStatic
getStatic
getStatic
getStatic
heapbottomReturn the n
least valuable elements of a heap-like Array
Array, should be an array-heap
Max number of elements
Optional
compare: Comparator<N>Optional compare function
Elements
Static
heapifyStatic
heappopExtract the peek of an array-heap
Array to be modified, should be a heap
Optional
compare: Comparator<N>Optional compare function
Returns the extracted peek
Static
heappushPushes a item into an array-heap
Array to be modified, should be a heap
Item to push
Optional
compare: Comparator<N>Optional compare function
Static
heappushpopStatic
heapreplaceStatic
heaptopReturn the n
most valuable elements of a heap-like Array
Array, should be an array-heap
Max number of elements
Optional
compare: Comparator<N>Optional compare function
Elements
Static
maxStatic
maxStatic
minStatic
minStatic
nlargestReturn the n
most valuable elements of an iterable
Max number of elements
Optional
compare: Comparator<N>Optional compare function
Elements
Static
nsmallestReturn the n
least valuable elements of an iterable
Max number of elements
Optional
compare: Comparator<N>Optional compare function
Elements
Static
print
Heap