Home > Back-end >  There are a great god can help you, first aid
There are a great god can help you, first aid

Time:09-29

[problem description]
An expression and a binary tree, there is a natural corresponding relation, write a program to implement the operation of the arithmetic expression based on expression tree said,
[tasks]
Assumes that the arithmetic expression can contain variables (a to z), constant (0 ~ 9) and binary operators (+, -, *,/, ^ (have been), implement the following operations:
(1) ReadExpre () - in the form of a character sequence input grammatically correct postfix expression and construct expression tree,
(2) WriteExpre () - with bracket infix expression output expression of E,
(3) the Assign () - the variable assignment in expression,
(4) the Value () - the arithmetic expression evaluation, E
[test data]
(1) any legal postfix expression,
After an expression, (2) whenever input variable assignment of them, and then evaluate the expression,
  • Related