Class IntervalHeap<T>
A binary interval heap is double-ended priority queue is a priority queue that it allows for efficient removal of both the maximum and minimum element.
Inheritance
Inherited Members
Namespace:KDTree
Assembly:cs.temp.dll.dll
Syntax
public class IntervalHeap<T>
Type Parameters
Name | Description |
---|---|
T | The data type contained at each key. |
Remarks
This is based on this: https://bitbucket.org/rednaxela/knn-benchmark/src/tip/ags/utils/dataStructures/trees/thirdGenKD/
Constructors
IntervalHeap()
Construct a new interval heap with the default capacity.
Declaration
public IntervalHeap()
IntervalHeap(Int32)
Construct a new interval heap with a custom capacity.
Declaration
public IntervalHeap(int capacity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | capacity |
Properties
Capacity
The current capacity of this interval heap.
Declaration
public int Capacity { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Max
Get the data with the largest key.
Declaration
public T Max { get; }
Property Value
Type | Description |
---|---|
T |
MaxKey
Get the largest key.
Declaration
public double MaxKey { get; }
Property Value
Type | Description |
---|---|
System.Double |
Min
Get the data with the smallest key.
Declaration
public T Min { get; }
Property Value
Type | Description |
---|---|
T |
MinKey
Get the smallest key.
Declaration
public double MinKey { get; }
Property Value
Type | Description |
---|---|
System.Double |
Size
The number of items in this interval heap.
Declaration
public int Size { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Insert(Double, T)
Insert a new data item at a given key.
Declaration
public void Insert(double key, T value)
Parameters
Type | Name | Description |
---|---|---|
System.Double | key | The value which represents our data (i.e. a distance). |
T | value | The data we want to store. |
RemoveMax()
Remove the item with the largest key in the queue.
Declaration
public void RemoveMax()
RemoveMin()
Remove the item with the smallest key from the queue.
Declaration
public void RemoveMin()
ReplaceMax(Double, T)
Swap out the item with the largest key in the queue.
Declaration
public void ReplaceMax(double key, T value)
Parameters
Type | Name | Description |
---|---|---|
System.Double | key | The new key for the largest item. |
T | value | The new data for the largest item. |
ReplaceMin(Double, T)
Replace the item with the smallest key in the queue.
Declaration
public void ReplaceMin(double key, T value)
Parameters
Type | Name | Description |
---|---|---|
System.Double | key | The new minimum key. |
T | value | The new minumum data value. |