What is Stack?

Similar to the Linked list and Queue ADT ,Stack is also use for storing the data.Stack is also an Sequential type data structure.

  • Stack is an Unordered list ,in which insertion and deletion operations are done at one end ,that is called top.
  • Stack is based on FIRST COME LAST SERVE(FCLS) or FIRST IN LAST OUT (FILO) or LAST IN FIRST OUT (LIFO) type serving strategy.
  • In Stack Insertion operation is called with special name PUSH,and Deletion operation is called as POP.
  • Both push and pop applies at same end,means at the top.
  • When Stack is empty ,and we want to delete the element (Pop) at the top ,then this situation is called Underflow situation of Stack.
  • When Stack is full and we want to insert an element (Push),then this situation is called Overflow situation of Stack.
  • Operation is applied at the top : Example

Stack in Real Life

  • A pile of plates are the good example of Stack.plate which is in the bottom of the pile ,those plate came into the pile at the first.
  • The Stack of trays in Cafeteria.
  • A driveway that is only one car wide.

Example of Push and Pop Operation

Operations of Stack

There are following some operation ,which can be applied on Stack :

  • Push : insertion of the Elements at the top of the Stack.
  • Pop : deletion of the Elements from the top of the Stack.
  • Searching : search for the specific elements in Stack.
  • StackSize : counting the number of the elements in Stack.
  • StackStates : check the Stack is Empty or Full.

Applications of Stack

  • Priority base Process Execution can be implemented using stack.
  • Symbol balancing of Programming Language like Parenthesis ,bracket balancing etc.
  • Infix-to-Postfix conversion.
  • Used in Compiler for Syntax parsing.
  • Used to implement Backtracking.
  • Used for memory management like compile time memory management.
  • Recursion is implemented using Stack.
  • UNDO functionality in any software application like MS Word,Notepad++ etc.
  • Tag matching in HTML.
  • Queue can be implement using Stack.
  • Tree and Graph traversal algorithm can be implemented using Stack like DFS etc.
  • Used for allocation and accessing of memory in Computer System architecture design.

Stack Representations

We can implement the Stack by the using of following data structure :

Leave a Reply

Your email address will not be published. Required fields are marked *