Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

the question didn't write what the operator so,will be add subtract divide plz follow the instructions and write a C code according to the instructions

the question didn't write what the operator so,will be add subtract divide plz follow the instructions and write a C code according to the instructions

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

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-! pop 10 pop 2 push2 push 10 push 9 push 6 Pop 6 pop 9 Pop 3 pop 12 pop answer: 4 push 2 + 10 = 12 push 9 - 6 = 3 push 12 / 3 = 4 6 10 9 3 HT 2 12 12 12 4 OPERATOR () ** INFIX FORMAT (OPERAND OPERATOR OPERAND) 2 3 5 OPERAND OPERATOR OPERAND EX2 ] 3=5+2 U 15 + 2 17 EX3 4 * (2 +3) 1 2 ) 3 PREFIX ( OPERATOR OPERAND OPERAND) EX1 2 + 3 + 2 3 EX2 35+2 *35 + 2 + *352 POSTFIX (OPERAND OPERAND OPERATOR) EX1 2 + 3 23 + EX2 385+2 35* + 2 35* 2 + EX3 312 3 +43/2 3 + 4 3* / 2 13+43 27 343 4 2 / +

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions

Question

Bring out the limitations of planning.

Answered: 1 week ago

Question

Why should a business be socially responsible?

Answered: 1 week ago

Question

Discuss the general principles of management given by Henri Fayol

Answered: 1 week ago

Question

Detailed note on the contributions of F.W.Taylor

Answered: 1 week ago

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago