Lets say I take a computation that involves only addition and multiplication:
(a+b)*(c+d)
which can be done in many other ways, eg.
a*(c+d) + b*(c+d)
a*c + a*d + b*c + b*d
In terms of additions and multiplications the number of operations required for each of the three examples shown are (2,1) (3,2) (3,4) respectively. Clearly, if the goal is to reduce the total number of operations the first is superior. Is there a way, given an arbitrary expression to find the computation order that requires the least number of operations?
Note: This question is being re-asked from SE.math for the insight and perspective of the CS crowd.