author: Torsten Gross @ Humboldt University Berlin / Charite Universitaetsmedizin Berlin

A sum where each of the N summands can be independently chosen from two choices yields 2^N possible summation outcomes. This is an O(K^2)-algorithm that finds the K smallest/largest of these sums by evading the enumeration of all sums.

As described in: "Sorting sums over binary decision summands" Torsten Gross, Nils Bluethgen, 2017