You are given all subset sums of an array. You are then supposed to recover the original array from the subset sums provided.
Every element in the original array is
Here's an easy algorithm that doesn't require finding which subset sums to a given number.
S ← input sequence
X ← empty sequence
While S has a non-zero element:
Output X.