A set is partitioned into $k$ non-empty sets, and the difference between elements of each subset is given, reconstruct each subset

57 Views Asked by At

We have a set $A = \{1, 2, 3, \dots, n\}$. This set is partitioned into $k$ non-empty subsets:

$$A_1 = \{a_1, a_2, \dots, a_{m_1}\}$$

$$A_2 = \{a_{m_1 + 1}, a_{{m_1} + 2}, \dots, a_{m_2}\}$$

$$.$$ $$.$$ $$.$$ $$A_k = \{a_{m_{k-1}+1}, a_{m_{k-1}+2}, \dots, a_n\}$$

where $a_i \in A$. For each set $A_i = \{a_{m_{i-1} + 1}, \dots, a_{m_i}\}$, we are given the values of

$$a_{m_{i-1} + 2} - a_{m_{i-1} + 1}$$ $$a_{m_{i-1} + 3} - a_{m_{i-1} + 2}$$ $$.$$ $$.$$ $$.$$ $$a_{m_i} - a_{m_i - 1}$$

I need an algorithm to reconstruct the subsets $A_1, A_2, \dots, A_k$. I thought that an invariant that would remain the same after the operation would be helpful in the reconstruction, but I wasn't able to identify any useful one. How do I solve this?

EDIT: This is a reduced form of a larger problem. This problem gave us, for each element $a_j$ in $A_i$, the number of elements less than $a_i$ in all subsets other than $A_i$. As pointed out in the comments below, this reduction means a loss of information which then makes it impossible to reconstruct the original subsets. So, I guess, my reduction was not helpful. But a solution to the problem prior reduction would be appreciated too.