0% found this document useful (0 votes)
36 views9 pages

Stack 131023084444 Phpapp01

The document explains how to evaluate the expression (A+B)*C where A=3, B=4, and C=5 using reverse polish notation. It shows the steps of pushing operands onto a stack, applying operators to pop operands off the stack, and pushing the results back on. The summary is: 1) The expression (A+B)*C is translated to AB+C* with A=3, B=4, C=5, becoming 34+5*. 2) The operands 3 and 4 are pushed to the stack, then popped and added, pushing the result 7 to the stack. 3) The operand 5 is pushed and popped with 7 to multiply, giving the

Uploaded by

Ajith Cristiano
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views9 pages

Stack 131023084444 Phpapp01

The document explains how to evaluate the expression (A+B)*C where A=3, B=4, and C=5 using reverse polish notation. It shows the steps of pushing operands onto a stack, applying operators to pop operands off the stack, and pushing the results back on. The summary is: 1) The expression (A+B)*C is translated to AB+C* with A=3, B=4, C=5, becoming 34+5*. 2) The operands 3 and 4 are pushed to the stack, then popped and added, pushing the result 7 to the stack. 3) The operand 5 is pushed and popped with 7 to multiply, giving the

Uploaded by

Ajith Cristiano
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Mahesh Kodituwakku

(A=3,B=4,C=5)
(A+B)*C
First step let's solve the brackets
(A+B)*C
(AB+)*C
Then we need to slove Mutipication
AB+*C
AB+C*
If A=3,B=4,C=5 then we have to write above
equitation as 34+5*



Step 1 is
Push(3) and Push (4)

3
4
Step 2 is
Pop(4) and Pop (3)and use expression +

3
4
Expression +
4 3
+
3+4=7
Step 3 is
Push(7) (Answer of 3+4=7)

7
Step 4 is
Then pop(5)to the stack

7
5
Step 5 is
Pop(5) and Pop (7)and use expression *

7
5
Expression *
5 7
*
7*5=35
Step 6 is
Push(35) to the stack

35
Answer is 35

You might also like