Skip to content

Stack

  • LIFO: Last In, First Out
  • Ideally built on top of Linked Lists
  • Preferred since it has dynamic memory allocation and sequential read or traversal is not needed

Operations

  • Push: add a new element to the top
  • Pop: remove and return the element from the top
  • Peek: return the element from the top, but do not remove it