Class FixedCapacityMinBinaryHeap<T>
- Namespace
- AlgorithmsSW.PriorityQueue
- Assembly
- AlgorithmsSW.dll
A container that allows efficient insertions and retrieval of the minimum element.
[AlgorithmReference(2, 6)]
public sealed class FixedCapacityMinBinaryHeap<T> : IPriorityQueue<T>, IEnumerable<T>, IEnumerable
Type Parameters
T
- Inheritance
-
FixedCapacityMinBinaryHeap<T>
- Implements
-
IEnumerable<T>
- Inherited Members
- Extension Methods
Constructors
FixedCapacityMinBinaryHeap(int, IComparer<T>)
public FixedCapacityMinBinaryHeap(int capacity, IComparer<T> comparer)
Parameters
Properties
Capacity
public int Capacity { get; }
Property Value
Count
public int Count { get; }
Property Value
IsEmpty
public bool IsEmpty { get; }
Property Value
IsFull
public bool IsFull { get; }
Property Value
IsSingleton
public bool IsSingleton { get; }
Property Value
PeekMin
public T PeekMin { get; }
Property Value
- T
Methods
AssertSatisfyHeapProperty()
[Conditional("WITH_INSTRUMENTATION")]
public void AssertSatisfyHeapProperty()
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<T> GetEnumerator()
Returns
- IEnumerator<T>
An enumerator that can be used to iterate through the collection.
PopMax()
public T PopMax()
Returns
- T
PopMin()
Retrieves and removes the minimum element in the heap.
public T PopMin()
Returns
- T
Exceptions
- InvalidOperationException
the heap is empty.
Push(T)
Pushes a new element onto the heap.
public void Push(T item)
Parameters
item
T
Exceptions
- InvalidOperationException
the heap is full.
- ArgumentNullException
item
is null.
ToPrettyString()
public string ToPrettyString()
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.