Skip to main content
5 of 5
added 93 characters in body

Minimum number of swaps to make multisets elements sums close

This problem was originally posted at math.stackexchange but there is no answer there, even after a (now expiring) bounty.

Choose $4$ multisets of size $n$ with elements $x \in \mathbb{R}$, $0 \le x \le 1$.

We want to swap elements between any two multisets repeatedly till the absolute difference between the sum of the elements of any multiset and the sum of the elements of any other multiset is not greater than $1$.

The worst case seems to be when two multisets are composed by all $1$ and the other two by all $0$, needing $n$ swaps.

For a generalization to $q$ multisets it seems that the worst case could be half multisets composed by all $1$ and the other half by all $0$, with $\frac{n\lfloor{q^2/4}\rfloor}{q}$ swaps.

Another observation (from here) is that if the sum of the elements of all multisets is $S$, and in the final valid configuration the minimum sum is $m$ then the sum of the elements of the other $3$ multisets must be less or equal than $3m+3$, therefore $4m+3 \ge S$, i.e. $m \ge (S-3)/4$, and similarly the maximum sum $M$ must satisfy $M \le (S+3)/4$.

I believe that we could arrange the elements in the four multisets $A = \{a_1, a_2, \ldots \},B = \{b_1, b_2, \ldots \},C = \{c_1, c_2, \ldots \},D = \{d_1, d_2, \ldots \}$ so that: $a_1 \le b_1 \le c_1 \le d_1 \le a_2 \le b_2 \le c_2 \le d_2 \le a_3 \le b_3 \le \ldots$, which guarantees the requirement, in at most $3n/2$ swaps, but this is more than the maximum conjectured value of $n$. [EDIT: I have no proof for the $3n/2$ bound, so it has no basis; I thought it were simpler.]

How can we prove that for any initial choice the number of needed swaps is at most $n$?