Title: Stack Data Structure (LIFO)


A stack is a linear data structure that follows the LIFO (Last In First Out) principle. This means the last element inserted is the first one to be removed.

Basic operations in stack:

  • Push (insert element)
  • Pop (remove element)
  • Peek (view top element)

Stacks are used in many applications such as expression evaluation, recursion, and undo operations.

For example, in a pile of plates, the last plate placed on top is removed first. This is how a stack works.

Comments

Popular posts from this blog