Stack - jaredgorski.org

Stack

data structures

A stack is similar to a Queue, except it’s LIFO (last in, first out). Stacks work exactly like a deck of cards: add a card to the top of the deck and then remove the same card from the top of the deck.

Stacks have two operations:

  • push
    • add an item to the top of the stack
  • pop
    • remove an item from the top of the stack