Last active
August 29, 2015 14:17
-
-
Save amelialaundy/bb9b495e0ecd296624cb to your computer and use it in GitHub Desktop.
stack.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
namespace StackQueue | |
{ | |
public class Stack | |
{ | |
List <object> store = new List<object>(); | |
public void Push(object x) | |
{ | |
store.Add(x); | |
} | |
public object Pop(object x) | |
{ | |
object last = store.Last(); | |
store.RemoveAt(store.count-1); | |
return last; | |
} | |
public object Peek() | |
{ | |
return store.Last(); | |
} | |
public bool Empty() | |
{ | |
if (store.Count > 0) | |
{ | |
return false; | |
} | |
else | |
{ | |
return true; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment