diff --git a/C#/Datastructures/Heap/Heap.cs b/C#/Datastructures/Heap/Heap.cs index 9d6738d..23254b2 100644 --- a/C#/Datastructures/Heap/Heap.cs +++ b/C#/Datastructures/Heap/Heap.cs @@ -23,5 +23,22 @@ namespace C_.Datastructures.Heap Count = 1 }; } + + public void Add(T value){ + Count++; + + if (Root == default) + {//If the new node needs to be added to the top of the heap + Root = HeapNode.Create(value); + return; + } + + //If the new node can be placed in a subchild + HeapNode node = Root; + + while(node.Left != default){ + node = node.Left; + } + } } } \ No newline at end of file