A Stack data structure can be use to evaluate post-fix expression. The algorithm uses a
from left to right char by char. If the read char is an operand then it is added to operand stack otherwise i.e., if it is operator then top most two operands in the stack are popped and the operator is applied on the operands and again the result is pushed in the stack. this process is continued until all the characters in the post fix expression are processed and at the end operand stack has one value which is the result of the expression.
Algorithm to
No comments:
Post a Comment