Evaluating the postfix conversion has following steps,
Evaluate the postfix Expression 6523+8*+3+*
- If the character is an operand push its associated values onto the stack.
- If the character is an operator,pop two values from the stack apply the operator to them and push the result on the stack.
EXAMPLE
Evaluate the postfix Expression 6523+8*+3+*
- First four symbols are placed on the stack.
- Next '+' is read ,so pop 3&2 from stack and their sum 5 is pushed.
- Next 8 pushed
- Now '*', so 5*8=40 is pushed
- Now '+' ,so 5+40=45 is pushed on the stack.
No comments:
Post a Comment