Question

QUESTION 9 Convert (8 – 5) / 2 expression from infix to reverse Polish (postfix) notation...

QUESTION 9

  1. Convert (8 – 5) / 2 expression from infix to reverse Polish (postfix) notation

    A.

    0.5*(8-5)

    B.

    -85/2

    C.

    8 5 – 2 /

    D.

    /2 – 85

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Given:

Infix Expression:- (8 - 5 ) / 2

Reverse Polish :- 8 5 - 2 /

Answer is C option.

Explanation:

while scanning the expression from left to right

1.we encounter '(' which is pushed into the stack so top='('

2.encountered '8' add to postfix exp , now postfix exp='8'

3. ' - ' is encountered push into stack now top= ' - '

4.5 is encountered add it to expression now postfix exp='8 5'

6.')' is encountered so pop all element from stack and add it to exp until stack is empty so postfix exp='8 5 -'

7.'/' is encountered push into stack top='/'

8. 2 is encountered add to exp now postfix exp='8 5 - 2'

9. expression scanning is done check stack encountered add it to exp

now Postfix Exp=' 8 5 - 2 /'

so answer is c : 8 5 – 2 /

Add a comment
Know the answer?
Add Answer to:
QUESTION 9 Convert (8 – 5) / 2 expression from infix to reverse Polish (postfix) notation...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT