摘要
本文对中缀表达式进行扫描,借助链栈创建二叉树,后序遍历二叉树实现表达式求值.比传统表达式求值方法有着更高的时间和空间效率,尤其适用于同一表达式对于多种赋值组合求值的情况,如判定逻辑表达式的类型等,具有一定的实用价值.
Through scanning infix expression,a binary tree can be created with chain stack. Base on the binary tree,the expression could be evaluated by postorder. It has more time and space efficiency than that of traditional methods of expression evaluation. Especially it fits the case that an expression has a variety of assignments,such as decision logic expression,which has practical value.
出处
《山西师范大学学报(自然科学版)》
2015年第2期39-43,共5页
Journal of Shanxi Normal University(Natural Science Edition)
关键词
中缀表达式
后序遍历
表达式求值
infix expression
postorder traversal
expression evaluation