Enhanced C#
Language of your choice: library documentation
Loyc.Collections.MaxHeap< T, TList, TComparer > Class Template Reference

Encapsulates algorithms for a max-heap, i.e. a priority queue that always knows the largest item and can remove it in O(log Count) time, or add a new item in O(log Count) time. More...


Source file:

Remarks

Encapsulates algorithms for a max-heap, i.e. a priority queue that always knows the largest item and can remove it in O(log Count) time, or add a new item in O(log Count) time.

Template Parameters
TItem type
TListList type that the heap object is a wrapper for
TComparerType used to compare items; an instance of this type must be provided to the constructor.

Call Push(T) to add a new item, Peek() to get the largest item, and Pop() or TryPop(out bool) to remove the largest item.

Most users will want to use the derived classes MaxHeap<T> or MaxHeapInList<T> to avoid dealing with three type parameters. Ideally this type would be a struct in order to maximize performance. It is a class in order to allow derived classes including MinHeap<T>.

See also
MaxHeap<T>
Type Constraints
TList :IList<T> 
TComparer :IComparer<T>