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.
StaticdefaultStaticgetStaticgetStaticgetStaticheapbottomReturn the n least valuable elements of a heap-like Array
Array, should be an array-heap
Max number of elements
Optionalcompare: Comparator<N>Optional compare function
Elements
StaticheapifyStaticheappopExtract the peek of an array-heap
Array to be modified, should be a heap
Optionalcompare: Comparator<N>Optional compare function
Returns the extracted peek
StaticheappushPushes a item into an array-heap
Array to be modified, should be a heap
Item to push
Optionalcompare: Comparator<N>Optional compare function
StaticheappushpopStaticheapreplaceStaticheaptopReturn the n most valuable elements of a heap-like Array
Array, should be an array-heap
Max number of elements
Optionalcompare: Comparator<N>Optional compare function
Elements
StaticmaxStaticmaxStaticminStaticminStaticnlargestReturn the n most valuable elements of an iterable
Max number of elements
Optionalcompare: Comparator<N>Optional compare function
Elements
StaticnsmallestReturn the n least valuable elements of an iterable
Max number of elements
Optionalcompare: Comparator<N>Optional compare function
Elements
Staticprint
Heap