That AST is what you'd get if you're associating from right to left (backward).
For instance, the subtree for 2*3*x is 2*(3*x) when it should be (2*3)*x.
2*3*x
2*(3*x)
(2*3)*x
Very nice. Didn't even think of using recursion on the remove.
This comment is hidden because it contains spoiler information about the solution
Loading collection data...
That AST is what you'd get if you're associating from right to left (backward).
For instance, the subtree for
2*3*x
is2*(3*x)
when it should be(2*3)*x
.Very nice. Didn't even think of using recursion on the remove.
This comment is hidden because it contains spoiler information about the solution