I have been searching for a solution to this problem:

I have an expression in infix which can contain *,/,-,+ and I have to find the reduced form

of this expression.

Ex: Input: ((A+45)*16+(B-C)*D/4 )/8+ 55

Output: A*2+B*D/32-C*D/32 +145

All that can be calculated must be calculated and the simplest form must be returned.

A,B,C,D do NOT have numeric values. They are name of variables(strings).

The expressions that have to be calculated can be more complicated.

I have found on the net algorithms that only evaluate expressions that have numerical values in them(or variables that are replaced by numerical values).

What I have done: I have translated the expression into expression tree form and now I'm a bit lost . Maybe I should have gone a different path ?

Can you help?

I have an expression in infix which can contain *,/,-,+ and I have to find the reduced form

of this expression.

Ex: Input: ((A+45)*16+(B-C)*D/4 )/8+ 55

Output: A*2+B*D/32-C*D/32 +145

All that can be calculated must be calculated and the simplest form must be returned.

A,B,C,D do NOT have numeric values. They are name of variables(strings).

The expressions that have to be calculated can be more complicated.

I have found on the net algorithms that only evaluate expressions that have numerical values in them(or variables that are replaced by numerical values).

What I have done: I have translated the expression into expression tree form and now I'm a bit lost . Maybe I should have gone a different path ?

Can you help?