Class MinHeap<T>
A MinHeap is a smallest-first queue based around a binary heap so it is quick to insert / remove items.
Inheritance
System.Object
MinHeap<T>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace:KDTree
Assembly:cs.temp.dll.dll
Syntax
public class MinHeap<T>
Type Parameters
Name | Description |
---|---|
T | The type of data this MinHeap stores. |
Remarks
This is based on this: https://bitbucket.org/rednaxela/knn-benchmark/src/tip/ags/utils/dataStructures/trees/thirdGenKD/
Constructors
MinHeap()
Create a new min heap with the default capacity.
Declaration
public MinHeap()
MinHeap(Int32)
Create a new min heap with a given capacity.
Declaration
public MinHeap(int iCapacity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iCapacity |
Properties
Capacity
The amount of space in this queue.
Declaration
public int Capacity { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Min
Get the data stored at the minimum element.
Declaration
public T Min { get; }
Property Value
Type | Description |
---|---|
T |
MinKey
Get the key which represents the minimum element.
Declaration
public double MinKey { get; }
Property Value
Type | Description |
---|---|
System.Double |
Size
The number of items in this queue.
Declaration
public int Size { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Insert(Double, T)
Insert a new element.
Declaration
public void Insert(double key, T value)
Parameters
Type | Name | Description |
---|---|---|
System.Double | key | The key which represents its position in the priority queue (ie. distance). |
T | value | The value to be stored at the key. |
RemoveMin()
Remove the smallest element.
Declaration
public void RemoveMin()