Team them up program results

Task definition

everyone belongs to one of the teams;

every team has at least one member;

every person in the team knows every other person in his team;

teams are as close in their sizes as possible

_______________________

Solution

Processing file input_01.txt

Persons

Person 1 knows 3 4 5

Person 2 knows 1 3 5

Person 3 knows 1 2 4 5

Person 4 knows 2 3 5

Person 5 knows 1 2 3 4

Team results

*** No solution - Person 4 is not member of any team

Teams

Team 1 - 1 3 5

Team 2 - 2

Processing file input_02.txt

Persons

Person 1 knows 2 3 5

Person 2 knows 1 3 4 5

Person 3 knows 1 2 5

Person 4 knows 1 2 3

Person 5 knows 1 2 3 4

Team results

*** Found solution

Teams

Team 1 - 1 2 3 5

Team 2 - 4

Processing file input_03.txt

Persons

Person 1 knows 2 3 4 5

Person 2 knows 1 3 4 5

Person 3 knows 1 2 4 5

Person 4 knows 1 2 3 5

Person 5 knows 1 2 3 4

Team results

Teams

Team 1 - 3 4 5

Team 2 - 1 2