- * / 15 - 7 + 1 1 3 + 2 + 1 1 = - * / 15 - 7 2 3 + 2 + 1 1 = - * / 15 5 3 + 2 + 1 1 = - * 3 3 + 2 + 1 1 = - 9 + 2 + 1 1 = - 9 + 2 2 = - 9 4 = 5
I need some guidance. I am trying to approach polish notation. From what I can see here right now is whenever we see two operators together, we could apply the operand recently aforementioned to the two operators right away. This is what I am having in mind. So from above,
- * / 15 - 7 + 1 1 3 + 2 + 1 1 = - * / 15 - 7 2 3 + 2 + 1 1 = So + 1 1 = 2, - 7 2 = 5 - * / 15 5 3 + 2 + 1 1 = - * 3 3 + 2 + 1 1 = - 9 + 2 + 1 1 = So / 15 5 = 3, * 3 3 = 9,
I just want to be really sure here. Is it safe to assume this procedure?:
- starting from the left side of the prefix equation, read the next character one by one.
- if there are two characters that are operands sequentially, we apply the preceding operator right away.
- Replace the operation just now with its result. (So + 1 1 becomes 2). Go back to step 2 if there are more possible operation.
Note: Could somebody with higher reputation tag this question for "polish notation", please?