diff --git a/C#/Datastructures/Stack.cs b/C#/Datastructures/Stack.cs new file mode 100644 index 0000000..d3841ca --- /dev/null +++ b/C#/Datastructures/Stack.cs @@ -0,0 +1,24 @@ +using C_.Datastructures.Nodes; + +namespace C_.Datastructures +{ + internal class Stack + { + + public StackNode? Head { get; set; } + public int Count { get; set; } + + public Stack Create(){ + //Create a new stack without a head + return new Stack{ Head = default, Count = 0}; + } + + public Stack Create(T value){ + //Create a new Stack with a head + return new Stack{ + Head = new StackNode{Value = value, Next = default}, + Count = 1 + }; + } + } +} \ No newline at end of file