35,15,+,80,70,-, *,20,/ //Suffix expression (((35+15) * (80-70)/20) =25// infix expression /,*,+,35,15,-, 80, 70, 20
The way people think is easy to fix ~~! Just as used to pull 10 into the system. Just about 2,3,4,8, and so on. ~~!
The way people are used to arithmetic is infix expression. And hit the prefix, suffix way: Confusion is just a way of expressing a formula (not the way you get used to)
I'm here to teach you a way that maybe your teacher didn't tell you. Simple conversion
A method of converting an infix to other formulas
Here I give an infix expression
a+b*c-(d+e) //infix expression
First step: Add parentheses to all units of operation by the operator's precedence
The formula becomes:(A + (b*c))-(d+e))
Step Two:conversion prefix and suffix expressions
Prefix: Move the operation symbol before the corresponding parenthesis
It becomes:-(+ (A * (BC)) + (DE))
Remove the brackets:-+a*bc+de prefixes appear
Suffix: Move the operation symbol after the corresponding parenthesis
It becomes:((A (BC) *) + (DE) +)-
Remove the brackets: theabc*+de+- suffix appears
Found no, prefix, suffix is not required to use parentheses to determine the priority.
If you're used to pulling his algorithm. It is calculated from the front of both operands
Or find the operator later. Instead of looking in the middle, then you can just mental arithmetic pull.
Go to network ...
This article link: http://www.cnblogs.com/Hslim/p/5008460.html
Infix expressions and pre-and suffix expressions convert simple tricks [go]