1. The prefix expression is called the Polish style, the suffix is called the inverse Polish style
2. Infix expression to the other two more simple, pre-and post-prefix infix more troublesome
3. The problem is to evaluate the expression or evaluation, if the evaluation is required two stacks, one is the operation Fu Yi, one is the operand stack, and so on after the stack of operators stack up, and the operation of the stack top two operand calculation and will
Results re-pressed into the stack
4. Only infix expressions have parentheses to say that the Polish and inverse Polish operations are strictly defined and do not require parentheses
5. The computer does not have the ability to calculate infix, it needs to be converted to polish or inverse Polish style
6. Polish-style and inverse Polish-type programming problems have not yet seen, only to fill in the blanks, perhaps because the computer is more need is polish and reverse Polish style
7. How to turn the Infix method to reverse Poland:
Number encountered: Direct output
Encountered ' (': Press stack
Encountered ') ': continues out of the stack, if the sign out of the stack is not ' (' then output, otherwise terminate the stack.
When the symbol is encountered, the operation priority of the symbol and the top of the stack is determined, and if the operation priority of the top symbol is high, the stack is stacked and output until the priority is equal or the stack is empty, and if the operation priority of the top symbol is lower or equal to the operation priority of the current symbol, the current symbol is pressed.
After the string is processed, all the remaining symbols in the stack are output.
8. The method of converting infix to Polish style:
Conversion to prefix: from right to left to iterate infix expression, encountered operand, output, encountered operator, the current operator priority is greater than or equal to the top of the stack operator priority, into the stack, otherwise, pop-up stack top priority is greater than the current operator operator, The current operator is in the stack. Encountered ') ': Press stack
Encountered ' (': Persist out of the stack, if the sign out of the stack is not ') ' then output, otherwise terminate the stack. After the string is processed, all the remaining symbols in the stack are output.
Prefix infix suffix expression