5

$N$ people are at a party and decide to play a cooperative game. They begin by standing in a circle. The game proceeds in turns. In each turn, one person is chosen to perform one of the following actions:

  • Shake hands with someone adjacent to them
  • Swap positions with someone adjacent to them

The game ends when every pair of players has shaken hands, and the aim of the game is to minimize the number of swaps required. What is the optimal strategy?

I've tried working through some small examples (e.g. $N = 3,4,5,6$ require $0,1,3,5$ swaps minimum but I can't really find a pattern in the strategy).

zhoraster
  • 26,086
Paradox
  • 659
  • 0 Swaps are required ... If everyone shakes the hand of the person adjacent to them, then no swaps are required. Do you mean to say that the purpose of the game is to minimize the number of turns? – Anthony P Dec 09 '16 at 06:12
  • If two people are standing on opposite sides of the circle, they will need to swap until they are adjacent so they can shake hands. – Paradox Dec 09 '16 at 06:13
  • Oh I see ... Everyone must shake with everyone. – Anthony P Dec 09 '16 at 06:21
  • There should be $n(n-1)/2$ handshakes in total. Initially there are $n$ pairs of neighbors, and swapping a couple of neighbors creates at most $2$ new pairs. Therefore, one needs at least $\lceil \frac12 (n(n-1)/2 - n)\rceil = \lceil n(n-3)/4\rceil$ swaps, which is equal to $0,1,3,5$ for $n=3,4,5,6$. However, at the moment I don't see whether this minimum can be realized. – zhoraster Dec 09 '16 at 13:48
  • 2
    This is closely related to the "$f(n)$" question at http://math.stackexchange.com/questions/833541/making-friends-around-a-circular-table#comment3053397_833541 (I think there's just an extra $\binom{n}{2}$ rounds here from the handshakes). The question there wasn't answered, but there was a fairly long discussion in the comments. – Kevin P. Costello Dec 13 '16 at 23:19
  • @KevinCostello, nice finding! I wonder why this question is much less popular than the one you point to. To the original asker: if you have something to add, please do. For example, it would be nice to explain the case $N=6$. Or if you are able to befriend everyone in $7$ swaps for $N=7$, that would be great! (It would be even better if you were able to prove that the former is impossible.) In absence of a complete answer before bounty expires (which seems very likely), I would be happy to award bounty to some useful partial progress. – zhoraster Dec 14 '16 at 15:18
  • I have one doubt. When one person selected he has to perform both tasks? – Kanwaljit Singh Dec 16 '16 at 16:05
  • 1
    I doubt that this has a simple solution. To play with: https://jsfiddle.net/zn1f30mv/5/show/ – leonbloy Dec 18 '16 at 01:28
  • @zhoraster I have one doubt. When one person selected he has to perform both tasks? – Kanwaljit Singh Dec 18 '16 at 08:17
  • @zhoraster when one person is selected he has to perform both tasks or only one. – Kanwaljit Singh Dec 18 '16 at 09:00
  • @KanwaljitSingh, OP says, "In each turn, one person is chosen to perform one of the following actions". Does this answer your question? – zhoraster Dec 18 '16 at 09:17

1 Answers1

-2

Suppose $\{a_1, a_2, ...,a_n\}$ people play this game. The pairs of neighbours are

$$ \{a_1,a_2\} $$ $$ \{a_2, a_3\} $$ $$ \vdots $$ $$ \{a_n, a_1\} $$

Which gives $n$ pairs of neighbours. Swapping with a neighbour perturbs the set by

$$ \{a_1, a_2, ... a_{n-k+1}, a_{n-k}, ..., a_n\} $$

So that, now, $a_{n-k+1}$ can shake with $a_{n-k}$ (which presumably they already have) and (more importantly) shake with $a_{n-k-1}$

In order to shake with everyone, the person originally at location $n-k$ must migrate (by swapping) around the ring to position $n-k+3$ (and I assume this person shakes with everyone along the way).

We need a total of $\frac{n(n-1)}{2}$ handshakes, and each swap allows us to shake hands with 2 new people (one with the person who swapped, and one with the person who got swapped).

I will propose that $\left\lceil \frac{n(n-1)}{4} \right\rceil $ swaps will guarantee everyone has shaken hands, but I have not come up with a minimum expression.

Perhaps someone might take over.

Anthony P
  • 619
  • 1
    As a courtesy, if somebody is going to "downvote" my answer, at least point out something I've done wrong or add something to it. Simply saying "this answer is not useful" without stating why is not useful. This is a community where we are all trying to learn. If you think I'm wrong, at least show me where. – Anthony P Dec 10 '16 at 04:22
  • It is not useful because: -this is not an answer; -there are some incorrect (or just meaningless) statements. You neither gave a strategy nor proved your amount to be minimal. – zhoraster Dec 10 '16 at 05:34
  • 1
    @zhoraster I showed that a number of swaps can guarantee that the game terminates, given everyone shakes in between swaps. If you have more to add to finding the solution, add it. – Anthony P Dec 10 '16 at 05:52
  • You didn't "show" this. You just "proposed" some number in the last paragraph. And you proposed in absolutely out of nowhere. If you really don't understand what is wrong in your post, I will try to help you. Concerning the last line of your comment, yes, I have more to find the solution and I had already added my comment. – zhoraster Dec 10 '16 at 06:07