摘要
中缀表达式是使用频率最高的表达式形式,对其求值时,一方面要考虑表达式中运算符的优先级,另一方面还要考虑运算符的结合性.尽管运用人的思维能容易地判断中缀表达式的运算顺序,但使用计算机直接处理就会显得非常困难.提出一种基于二叉树的方法,即将中缀表达式转换为前缀表达式,然后在计算机上就可以实现简单求值.
Infix expression has the highest usage frequency. For solution, on one hand, priority of operator in expression should be considerd. On the other hand, associativity of operator must considered too. Although it is not difficult for human being' s thinking to judge the operation order of infix expression, it is very difficult for computer to compute directly. A method was proposed based on the binary tree, which transform infrx expression into prefex expression, then solution rules will be simple for computer computing.
出处
《成都大学学报(自然科学版)》
2012年第3期247-250,263,共5页
Journal of Chengdu University(Natural Science Edition)
关键词
中缀表达式
前缀表达式
二叉树
infix expression
prefix expression
binary tree