A stack is needed to convert infix notation to postfix notation. A stack is a container of objects that are inserted and removed according to LIFO (last in first out) principle. Two operations are used push and pop.
Push:- Add an element to the collection
Pop:- removes the most recently added element that was not yet removed.