algorithm for making sure everyone is in the same group

50 Views Asked by At

a group of x people where you have to choose 2 people at least 1 person is guaranteed to be selected to be in your group, is it possible to make sure everyone is in the same group

try to sort people in a circle and make sure everyone selects the person in front of them and behind them

1

There are 1 best solutions below

0
Matt Timmermans On

Start with a triangle -- 3 people, each of which selects the other two. They are guaranteed to end up in the same group, because at least 2 of them will be grouped, and the 3rd person selected both of them.

Now you can add as many people to the group as you like. Each new person just has to select 2 people that are already guaranteed to be in the group. and then they will be guaranteed to be in the group as well.