Stacks

A stack is a type of data structure. Imagine it as a stack of plates. When we take a plate, we take the plate at the top.

When we add a plate, we add it to the top.

First in, first out.

Stacks have 2 operations.

  • .append(x) - Appends the item to the top of the stack

  • .pop() - Takes the item on the top of the stack

Last updated