Language:EN
Pages: 3
Words: 576
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
reverse polish notation assignment answersstudent

Reverse polish notation assignment answersstudent submitted image

Reverse Polish Notation Assignment Answers

Question:

student submitted image, transcription available below

Reverse Polish Notation Answer and Explanation

1. Read the postfix expression from left to right.

2. Use a stack to hold operators and operands.

1. Read U - Push `U` onto the stack.

2. Read V - Push `V` onto the stack.

7. Read `+` - Pop `Y` and `Z` from the stack, form the expression `(Y + Z)`, and push it back onto the stack.

8. Read `*` - Pop `(Y + Z)` and `X` from the stack, form the expression `X * (Y + Z)`, and push it back onto the stack.

`U + (V * (W + (X * (Y + Z))))`

### Expression b) XYZ+VW-*Z++

5. Read V - Push `V` onto the stack.

6. Read W - Push `W` onto the stack.

11. Read `+` - Pop `(Y + Z) * (V - W) + Z` and `X` from the stack, form the expression `X + ((Y + Z) * (V - W) + Z)`, and push it back onto the stack.

The infix notation for expression b) is:

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : Wahida rehmani

PageId: DOCF0FBE0F