Binary heap, using an array implementation.
More...
|
| BinaryHeap (IComparer< T > comparer) |
|
override int | Count () |
|
override void | Insert (T value) |
| Inserts a value into the heap. The heap property is restored.
|
|
override bool | IsEmpty () |
|
override T | Peek () |
|
override T | Remove () |
| Removes the root-node of the tree and restructures the tree accordingly.
|
|
| AHeap (IComparer< T > comparer) |
|
int | Count () |
|
void | Insert (T value) |
|
bool | IsEmpty () |
|
T | Peek () |
|
T | Remove () |
|
Binary heap, using an array implementation.
- Template Parameters
-
◆ BinaryHeap()
- Parameters
-
comparer | Compares each element for heap ordering. If you use default-sorting, the structure is a max-heap. If you reverse the comparison function it becomes a min-heap |
◆ Count()
- Returns
- The number of elements within the heap
◆ Insert()
override void Insert |
( |
T | value | ) |
|
Inserts a value into the heap. The heap property is restored.
- Parameters
-
◆ IsEmpty()
override bool IsEmpty |
( |
| ) |
|
- Returns
- True if the heap contains no element, or false otherwise
◆ Peek()
- Returns
- Returns the value of the root-node of the tree without removing it
◆ Remove()
Removes the root-node of the tree and restructures the tree accordingly.
- Returns
- The value stored at the root-node (same as Peek())