Stack is a linear data structure that is widely used in operating systems and many applications. The stack implies an office stack of files in which you put new files on the top and the employee always take care of the newly arrived file first.
Similarly, when a stack is implemented in whichever method you want it to, newly elements are added to or deleted from the top of the stack, and stack operations always take the top elements and work its way downwards until the stack is empty.
Two ways to implement a stack are:
- Linked Lists
The linked list structures are dynamic but, that doesn’t mean that you can insert or delete element from the middle or somewhere in the list.
Applications of Stack
Here I give you some programs to implement stack to solve a programming problem in different programming languages.
- Tower of Hanoi
- Implement Stack in C
- Implement Stack using Linked List
- Evaluating Postfix Expressions
- Convert Infix to Postfix Expressions
- Convert Infix to Prefix Expressions