Stack Data Structure

Stacks are an elementary Data Structure where all interaction with the data is done through the looking at the first element.

There are two main operations on Stacks, Push and Pop.

The push operation is used to insert an item into the stack. The name push comes from the fact that when an item is inserted into the stack it is put into the first element in the stack, so we think of it as lying on top of the stack.

Likewise, the pop operation is used to remove an item from the stack. Items are removed from the top of the stack first.

Last Popped Value
Next Value to Push