| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 12407 | DS_2019Fall_HW_1 |
|
Description
In this homework, you are asked to implement three functions. They are
- Convert infix expression to postfix expression (infix2postfix)
- Convert infix expression to prefix expression (infix2prefix)
- Evaluate the value of the given infix expression (evaluate infix)
Input consist of operators and operands. Operators: { +,-,*,/,(,) }, / means integer division here. For example: 5/2 = 2, 11/3=3.
1 <= Operands <=9
Input
Each test case contains multiple inputs. Each input is a string of infix expression.
Input consist of operators and operands. Operators: { +,-,*,/,(,) }, / means integer division here. For example: 5/2 = 2, 11/3=3. Operands 1 <= Operands <=9
5 <= |Operators| + |Operands| <= 2500
Output
For each input infix expression, output its postfix expression, prefix expression, and evaluate result, separated by a newline symbol.