Hi there, i´m trying to sort a list of combinations in a specific way. Consider the numbers 1-6 as teams, if every team can play on time against each other team we got this list as possible matches:
12 23 34 45 56
13 24 35 46
14 25 36
15 26
16
So now what i want is something like "matchdays":
12 13 14 15 16
34 46 26 24 23
56 25 35 36 45
As you can see after each block every team has one game, two games, ...
I could´n get a algorithm to sort the list this from:
12 13 14 15 16 23 24 25 26 34 35 36 45 46 56
to
12 34 56 13 46 25 14 26 35 15 24 36 16 23 45
Additional: With odd team numbers the way to create matchdays gets even worse because you have to leave on team out for the day:
12 23 34 45
13 24 35
14 25
15
12 23 14 24 25
34 45 35 15 13
In the first block 5 is not playing in the second block 1 ist not playing....
Thank you for any help or ideas regarding this problem in c# with .net 4 possibly using Linq to manipulate the list.
SOLUTION:
Round-robin tournament
http://en.wikipedia.org/wiki/Round-robin_tournament
http://stackoverflow.com/questions/1293058/round-robin-tournament-algorithm-in-c