Updated Heap to allow Heap Creation (Not fully implemented)

This commit is contained in:
Luke Else 2022-11-04 11:28:52 +00:00
parent 78ac09c4e9
commit e2157e7093

View File

@ -23,5 +23,22 @@ namespace C_.Datastructures.Heap
Count = 1 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<T>.Create(value);
return;
}
//If the new node can be placed in a subchild
HeapNode<T> node = Root;
while(node.Left != default){
node = node.Left;
}
}
} }
} }