C# implementation of min-heap and max-heap.
- MinHeap<T>
- MinHeap<TKey, TValue>
- MinHeap<TKey, TValue, TDictionary>
- MaxHeap<T>
- MaxHeap<TKey, TValue>
- MaxHeap<TKey, TValue, TDictionary>
var heap = new MinHeap<int>();
heap.Add(3);
heap.Add(9);
int x = heap.ExtractMin(); // Returns 3.
int num = heap.Count; // Returns 1.
int y = heap.ExtractMin(); // Returns 9.
var heap = new MinHeap<string, int>();
heap.Add("item1", 3);
heap.Add("item2", 4);
heap.Add("item3", 5);
heap.ChangeValue("item2", 1); // Now value of "item2" is 1.
int x = heap.ExtractMin(); // Returns 1.
All tests can be run with NUnit 3.
Public domain.