private void Swap(NodeHeap <T, V> node1, NodeHeap <T, V> node2) { var temp = new NodeHeap <T, V>(node1.Key, node1.Value); node1.Key = node2.Key; node1.Value = node2.Value; node2.Key = temp.Key; node2.Value = temp.Value; }
public void Insert(T key, V value) { if (Size == capacity) { throw new ArgumentOutOfRangeException(); } var newNode = new NodeHeap <T, V>(key, value); Size++; nodes[Size] = newNode; SiftUp(Size); }