6 - Postfix Expression Evaluation Using Stack Data Structure
6 - Postfix Expression Evaluation Using Stack Data Structure
Unit -3
Postfix Expression Evaluation using Stack
Pankaj Chandra
Assistant Professor
IT GGV
Postfix Expression Evaluation using Stack
A postfix expression can be evaluated using the Stack data structure. To
evaluate a postfix expression using Stack data structure we can use the
following steps –
1.Read all the symbols one by one from left to right in the given Postfix Expression
3.If the reading symbol is operator (+ , - , * , / etc.,), then perform TWO pop
operations and store the two popped operands in two different variables (Value1
and Value2).
Value 1 = Top Element
Value 2 = Next to Top Element
Postfix Expression Evaluation using Stack