Applications

Applications of Stack:

Some of the real time applications of Stack include:

• Reverse Order: 

        When we need to print the string in reverse order, we can use stack as it follows FILO. Ex: we have given input S,T,A,C,K as input and we want output as reverse order  K,C,A,T,S.

• Undo:

         Undo option we generally use to discard last action we did.  It exactly follows the FILO .

         Example : While playing online chess game we do use undo function , to change our game strategy.

Call Stack:

         To keep track of call stack in computer programming. Used by most compilers.

Parentheses Balance Check:

         To solve the Parentheses Balance , we generally push the open parentheses in stack and pop out closing parentheses . After pop out all elements ,if nothing in stack means parentheses are matched else  balance is missing  .

Try here>>>