I'm trying to generate all possible equations given an String array of operators (+,-,*,/) and an String array of variables (a,b,c ...). Each equation will be composed of pairs of variables and numbers (a+ b- c/ b), except the last variable, which has no operator following it. The algorithm must generate equations of variable lengths (2 terms, 6 terms, etc). What would be the most efficient way to generate this list in Java?
Please, don't do it recursively. :)
Um, no this is not homework. Its a personal project where I'm trying to utilize genetic algorithms to find optimal equations to fit data. A description of an algorithm in general terms would suffice if you believe so.