I have a set of mathematical expressions (only contains sum (+) operation). Here is an example:
$$E1= a+b+c$$ $$E2= a+b+d$$ $$E3= a+b+c+e$$ $$E4= a+b+d+f$$
I want to know if there is a method or algorithm to compute these expressions by using the minimum number of operations. So that for my example:
$$R1=a+b+c$$ $$R2=R1-c+d$$ $$R3=R1+e$$ $$R4=R2+f$$
In this example, computing each expression separately needs 10 operations, but by reusing the repeated parts we will find all results with 6 operations.
Any suggestions?