Skip to content

Instantly share code, notes, and snippets.

@amelialaundy
Last active August 29, 2015 14:17
Show Gist options
  • Save amelialaundy/bb9b495e0ecd296624cb to your computer and use it in GitHub Desktop.
Save amelialaundy/bb9b495e0ecd296624cb to your computer and use it in GitHub Desktop.
stack.cs
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