|
Heap
The Heap data structure
[Serializable]
public class Heap<T> : IVisitableCollection<T>, IHeap<T>
{
// Methods
public T RemoveRoot();
public void Add(T item);
// ...
// Properties
public int Count { get; }
public T Root { get; }
public HeapType Type { get; }
// ...
}The Heap data structure is a tree structure with a special property: either the smallest item (a Min-Heap) or the largest item (a Max-Heap) is contained in the root of the tree. The Heap implemented in this library can either be a Min-Heap or a Max-Heap, and is set on the constructor. For a Max-Heap, the IComparer<T> instance used is wrapped in a ReverseComparer<IComparer<T>> instance, thus reversing the comparison decision and sorting in the opposite order. | |
► Sign in to add a comment