Question: data structure Algorithm for Evaluation of Postfix Expression Create an empty stack and start scanning the postfix expression from left to right. If the element

 data structure Algorithm for Evaluation of Postfix Expression Create an empty

data structure

Algorithm for Evaluation of Postfix Expression Create an empty stack and start scanning the postfix expression from left to right. If the element is an operand, push it into the stack. If the element is an operator o, pop twice and get A and B respectively. Calculate BOA and push it back to the stack. When the expression is ended, the value in the stack is the final answer. Evaluation of a postfix expression using a stack is explained in below example: 2 10 + 96.1 push 2 push 10 pop 10 pop 2 push puh6 pop 6 pop Pop 3 pop 12 pop a 4 push 2 + 10 - 12 push 9.6 - 3 push 12/3-4 10 9 3 2 12 12 12

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!