title: Mathematical Expression generation preferably without using stacks or queues
body: <p>Given the allowed operators of +, /, -, *, and given a user inputted list of single digit numbers (any length allowed), how can I output <strong>all</strong> possible combinations of mathematical expressions (and the resulting values) that can be formed with the numbers and the given constant set of operators?  I also want allow for scalability, for example, so that I can easily be able to add another operator in the mix (if possible).</p>
  
  <p>Preferably the solution wouldn't use a stack or queue but they are not unacceptable.</p>
  
  <p>For example, if the input is:</p>
  
  <pre><code>{1,3,5,7}
  </code></pre>
  
  <p>then possible output would be </p>
  
  <pre><code>(1+3)-(5+7) = -8
  (1+5)-(3-7) = 10
  etc...  
  </code></pre>
  
  <p>(13+57) is <strong>not</strong> a possible combination since combining of the digits should not be allowed.</p>
  
  <p>Also note: I was able to write something similar using Scheme to do this, but I can't seem to do it with Java or C#.</p>