Construct a binary tree for the defined expression, and show result of pre-order and post-order.
Example:
Input:
(a+b)*(c/(d-e))
Output:
*+ab/c-de
ab+cde-/*
数据结构老师出的实验题,原意是要我们建立表达式树来解决,不过我刚好在书上看到一种O(n)的算法,于是用着这方法写了一下,答案是一样的。
里面用到的栈模板是我以前写好的,直接复制过来用~~~
2836

被折叠的 条评论
为什么被折叠?



