From bff4abff01db2e03e52f8840249451d047bec292 Mon Sep 17 00:00:00 2001 From: Luke Else Date: Thu, 31 Mar 2022 21:32:42 +0100 Subject: [PATCH] Stack Completed --- C#/Datastructures/Stack.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/C#/Datastructures/Stack.cs b/C#/Datastructures/Stack.cs index 79bf988..625319c 100644 --- a/C#/Datastructures/Stack.cs +++ b/C#/Datastructures/Stack.cs @@ -21,7 +21,7 @@ namespace C_.Datastructures } public void Push(T value){ - //Add an Item to the end of the list + //Add an Item to the top of the stacks if (Count > 0) { Count++; @@ -31,6 +31,7 @@ namespace C_.Datastructures } public T? Pop(){ + //Take the item off of the top of the stack T? value = default; if (Count > 0) {//Assign the default value if there are any items left in the stack @@ -42,6 +43,7 @@ namespace C_.Datastructures } public T? Peek(){ + //View item on top of the stack if (Count > 0) { return Head!.Value;