Binary heap wrapper around the IList It's a max-heap implementation i.e. the maximum element is always on top. But the order of elements can be customized by providing IComparer instance.
BinaryHeap
| Name | Description |
|---|---|
T | The type of the items in the source list. |
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| .ctor | 2 | Initializes a new instance of the BinaryHeap class. |
| Push | 1 | Pushes item to the heap. |
| Pop | 1 | Pops the item from the heap. |
| SiftDown | 1 | Restores the heap property starting from i'th position down to the bottom given that the downstream items fulfill the rule. |
| SiftUp | 1 | Restores the heap property starting from i'th position up to the head given that the upstream items fulfill the rule. |
| Swap | 1 | Swaps items with the specified indicies. |
03 Properties
04 Fields
05 Members
IList(Of `0))Initializes a new instance of the BinaryHeap class.
| Name | Type | Description |
|---|---|---|
buffer | IList(Of `0) | The buffer to store heap items. |
IList(Of `0), IComparer(Of `0))Initializes a new instance of the BinaryHeap class.
| Name | Type | Description |
|---|---|---|
buffer | IList(Of `0) | The buffer to store heap items. |
comparer | IComparer(Of `0) | The comparer which defines order of items. |
`0)Pushes item to the heap.
| Name | Type | Description |
|---|---|---|
item | `0 | The item to push. |
Pops the item from the heap.
The popped item.
Int32)Restores the heap property starting from i'th position down to the bottom given that the downstream items fulfill the rule.
| Name | Type | Description |
|---|---|---|
i | Int32 | The position of item where heap property is violated. |
Int32)Restores the heap property starting from i'th position up to the head given that the upstream items fulfill the rule.
| Name | Type | Description |
|---|---|---|
i | Int32 | The position of item where heap property is violated. |
Int32, Int32)Swaps items with the specified indicies.
| Name | Type | Description |
|---|---|---|
i | Int32 | The first index. |
j | Int32 | The second index. |
Gets the heap comparer.
Gets the buffer of the heap.