BinaryHeap
This is a class I took from something Rust related. You can read its documentation info here.
Properties
ComparisonFunction
BinaryHeap.ComparisonFunction:
ComparisonFunction
<
Comparable
>
?
The ComparisonFunction of the BinaryHeap.
Length
BinaryHeap.Length:
int
The Length of the BinaryHeap.
Functions
new
BinaryHeap.
new
(
ComparisonFunction:Â
ComparisonFunction
<
Comparable
>
?
--
The comparison function.
) →Â
BinaryHeap
<
T
>
Creates a new BinaryHeap.
Push
BinaryHeap:
Push
(
Key:Â
Comparable
--
The key you are pushing. Must be able to work with comparing methods like <
.
) →Â
int
--
The index of the pushed key in the heap.
Pushes a new key to the heap.
Pop
BinaryHeap:
Pop
(
) →Â
Comparable?
--
The minimum element if it exists, otherwise nil.
Removes the minimum element (the root) from the heap and returns it.
Delete
BinaryHeap:
Delete
(
Index:Â
int
--
The index of the key you want to delete.
) →Â
BinaryHeap
<
T
>
--
Returns the same heap.
Deletes the key at Index by shifting it to root (treating it as -infinity) and then popping it.
GetFront
BinaryHeap:
GetFront
(
) →Â
T
--
The first value.
Returns the front value of the heap.
IsEmpty
BinaryHeap:
IsEmpty
(
) →Â
boolean
-
True
iff
the
heap
is
empty.
Determines if the heap is empty.