Stacks (evaluating postfix expression)

I'm a little confused so if someone can confirm if I am doing that would be great.

Evaluate postfix expression:

1 2 + 4 * 5 6 * 10 / 8 * +

Me evaluating:

1) 1

2) 2 1

3) 3

4) 4 3

5) 12

6) 5 12

7) 6 5 12

8) 30 12

9) 10 30 12

10) Here's where I get confused. Do I do 30/10 or 10/30 (and is it the same way for subtraction)...3 12

11) 8 3 12

12) 24 12

13) 36

Re: Stacks (evaluating postfix expression)

From Wikipedia:

Operations which are non-commutative are still written in "conventional order", i.e.:

a b op = a op b

4 2 / = 4 / 2 = 2

2 4 / = 2 / 4 = 0.5

Re: Stacks (evaluating postfix expression)

Quote:

Originally Posted by

**helloworld922**
From

Wikipedia:

Operations which are non-commutative are still written in "conventional order", i.e.:

a b op = a op b

4 2 / = 4 / 2 = 2

2 4 / = 2 / 4 = 0.5

So I guess 36 is right, thanks