> For the complete documentation index, see [llms.txt](https://mqjyl2012.gitbook.io/algorithm/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mqjyl2012.gitbook.io/algorithm/classical-problem/expression-evaluation.md).

# 表达式求值

表达式求值是栈的一个重要的应用。表达式的表示方法主要有中缀表示法、前缀表示法和后缀表示法。其中前缀表达式又叫做**波兰表达式**，后缀表达式又叫做**逆波兰表达式**。

* 前缀转中缀，中缀转前缀
* 中缀转后缀，后缀转中缀
* 前后缀之间的相互转换可以用中缀作为中转来解决，或者也可以构造语法树遍历来解决。
* 前缀表达式求值，后缀表达式求值，中缀表达式求值比较简单

### :pen\_fountain: 前缀 <--> 中缀

### :pen\_fountain: 后缀 <--> 中缀

### :pen\_fountain: 构造语法树

### :pen\_fountain: 表达式求值

### :pen\_fountain: 相关题型


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mqjyl2012.gitbook.io/algorithm/classical-problem/expression-evaluation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
