Hello! The task is to simplify the mathematical expression whenever possible. To simplify is to result in a shorter look. The expression is stored in reverse polish notation, or as a tree. For example, the expression x*2-(x+x) is stored as a tree -
(-) / \ (*) (+) / \ / \ (x) (2)(x)(x) or in the SCR - x2*xx+- Tell me, what algorithms are there for this.