Class MaxHeap
A binary heap implementation that maintains the maximum element at the root.
Inherited Members
Namespace: EarleyParser
Assembly: EarleyParser.dll
Syntax
public class MaxHeap
Properties
| Edit this page View SourceCount
Gets the number of elements in the heap.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
Elements
Gets the elements in the heap.
Declaration
public List<int> Elements { get; }
Property Value
| Type | Description |
|---|---|
| List<int> |
Max
Gets the maximum element in the heap.
Declaration
public int Max { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
| Edit this page View SourceAdd(int)
Adds a new element to the heap.
Declaration
public void Add(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The value to add. |
Clear()
Removes all elements from the heap.
Declaration
public void Clear()
PopMax()
Removes and returns the maximum element from the heap.
Declaration
public int PopMax()
Returns
| Type | Description |
|---|---|
| int | The maximum element. |