Home » Blog » Stack – Data Structure

Stack – Data Structure

A stack is a simple data structure that adds and removes elements in a particular order.
Every time an element is added, it goes on the “top” of the stack. Only an element at the top of the stack can be removed, just like a stack of plates. This behavior is called LIFO (Last In, First Out).


Terminology
Adding a new element onto the stack is called push.
Removing an element from the stack is called pop.

Applications
Stacks can be used to create undo-redo functionalities, parsing expressions (infix to postfix/prefix conversion), and much more.

A stack can be implemented using an array or a linked list.

Leave a Reply

Your email address will not be published.