I have a question that I think is related to this one:
Algorithm wanted: Enumerate all subsets of a set in order of increasing sums
but I couldn't adapt it to my problem, which is:
Given a series $S = \pm x_1 \pm x_2...\pm x_n$, where $x_i > 0$, enumerate all possible sign configurations in order of the increasing value of $S$.
For instance, consider the series $[1,1,2,2]$:
\begin{align} &-1-1-2-2 = -6\\ &+1-1-2-2 = -4\\ &-1+1-2-2 = -4\\ &+1+1-2-2 = -2\\ &-1-1+2-2 = -2\\ &-1-1-2+2 = -2\\ &+1-1+2-2 = 0\\ &+1-1-2+2 = 0\\ &-1+1+2-2 = 0\\ &-1+1-2+2 = 0\\ &-1-1+2+2 = 2\\ &+1+1+2-2 = 2\\ &+1+1-2+2 = 2\\ &+1-1+2+2 = 4\\ &-1+1+2+2 = 4\\ &+1+1+2+2 = 6\\ \end{align}
$n$ can be large, so it's infeasible to enumerate and sort all possible combinations. I've tried a few things but couldn't get around it.
Any ideas on what to search for? I'd greatly appreciate it!