Updated Heap to allow Heap Creation (Not fully implemented)
This commit is contained in:
parent
78ac09c4e9
commit
e2157e7093
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user