4 ms·
Consider the balloon arrangement as a permutation, where balloons every balloon has a person and every person has a balloon. If you know the permutation, then y
by mac3n 5y ago
Consider the balloon arrangement as a permutation, where balloons every balloon has a person and every person has a balloon.
If you know the permutation, then you can invert it to send each balloon to its person.
You're assuming it's easier to find people than balloons, otherwise you don't know the permutation. If several people share a name, you need multiple passes.
I used a form of this, where every processor in an array wanted to request something from another processor in some permutation. If they all know the permutation, then you can skip the request part and send the reply directly to the one who wants it.