introduction to stacks

what is a stack?

the stack is one type of linear data structure. the elements in the stack are removed or ca be added only through one end, so stacks are called as LIFO (Last-In-First-Out) data structure, the element which is inserted at the last, that element can be deleted first

let’s look into the real world example

Embed from Getty Images

in the above examples, there are a stack of chairs, the user first inserted yellow chair and last chair will be brown, if the user wants to remove the orange chair, first brown and then the blue chair should be removed, user cant removed any middle chair without removing its above chairs

Applications of stacks

  • UNDO and REDO
  • Backtracking
  • Memory management
  • Expression Conversion like prefix, postfix, infix
  • Parsing

stacks visual in data structures

introduction to stacks 1

Default image
Vishal Devxo
Vishal Devxo is a DevOps engineer and a Backend developer, he spends all his time for creating good tutorials with better visuals and blogging, developed some projects based on Python-Django, some hacking modules and scripts in python