what is benefits for changing from infix to postfix?

妖精的绣舞 提交于 2019-12-14 03:44:21

问题


I read book today. It introduced algorithm about chaning from infix to postfix.. What is benefits? Thanks in advance.


回答1:


Well for one, you can easily evaluate a postfix expression in a single scan from left to right with the help of a stack, unlike evaluating infix expressions. and second, there is no need of the concept of parentheses and precedence rules etc. in a postfix expression.




回答2:


I think infix is really easy to understand for human. Postfix is the good way for machine to process. Please prefer: http://www.cs.man.ac.uk/~pjj/cs2121/fix.html




回答3:


An advanced example that also illustrates the convenience of infix to prefix/postfix :

Writing your own Regular Expression Parser : The regular expression input with paranthesis ie, (a+b)*(c+d) is converted to prefix/postfix, before the state machine for the regular expression is built




回答4:


infix and postfix concept are used in compiler design. Because Infix is so common in mathematics, it is much easier for humans to read, and so is used in most computer languages. Postfix is easier for computers to process, but not as intuitive for humans.



来源:https://stackoverflow.com/questions/13397563/what-is-benefits-for-changing-from-infix-to-postfix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!