Prefix Notation
来源:互联网 发布:邪恶镰刀 数据 编辑:程序博客网 时间:2024/06/05 20:01
Polish Notation
1.Introduction
Polish notation, also known as Polish prefix notation or simply prefix notation, is a form of notation for logic, arithmetic, and algebra. Its distinguishing feature is that it places operators to the left of their operands.
For instance, the expression can be written in conventional infix notation as (5-6)*7,can be written in prefix as *-567. Next we will show how it changes from infix to prefix.
2.Algorithms
1)Create a stack to store operators or brackets
2) Scan the expression from the right to left. If the current character is the digit, then output it, and if it is the operator, then compare the priority and push it into the stack if it is high priority.
3) Continue the step 2, until all characters are scanned, and pop up all operators in the stack.
4) Output the result reversely.
3.Calculate
1) Scan from right to left, push the digits into a stack
2) If a operator occurs, then pop up the first both digits and calculate. After that, push the result into the stack.
3) Continue step 2 until it ends.
0 0
- Prefix Notation
- prefix
- hungariant notation
- Dot Notation
- CIDR Notation
- Dot Notation
- Hungarian Notation
- Asymptotic notation
- Yoda Notation
- Exponential notation
- do notation
- Known Notation
- lock prefix
- USACO prefix
- prefix(2)
- USACO/prefix
- make prefix
- Longest Prefix
- 全选和全不选
- mongodb性能监控优化
- c
- 多边形裁剪一:Sutherland-Hodgman算法
- USACO2.4.4 Bessie Come Home (comehome)
- Prefix Notation
- dom4j解析xml文档(-)
- Quartz任务调度器及其在Spring中的使用
- ArrayList.add(index, element)失败,都是size的误解
- 单例模式2
- modem.generator不能继承的原因
- java中的各种数据类型在内存中存储的方式
- UITableView 上滑动 隐藏搜索框,下滑,显示搜索框
- Hduoj2512【DP】