Stack data structure is suitable for evaluating postfix expression. Stack : Stack is a linear data structure in which elements are inserted and deleted from one end only i.e. top of the stack. It follows a order to insert the elements into stack which is known as LIFO (Last in first out).
Which data structure is used for expression evaluation?
The stack organization is very effective in evaluating arithmetic expressions. Expressions are usually represented in what is known as Infix notation, in which each operator is written between two operands (i.e., A + B).
What is postfix notation in data structure?
Postfix notation is also called as ‘suffix notation’ and ‘reverse polish’. Postfix notation is a linear representation of a syntax tree. In the postfix notation, any expression can be written unambiguously without parentheses. The ordinary (infix) way of writing the sum of x and y is with operator in the middle: x * y.