I am searching for an algorithm to calculate pairs from a class of n (a list of student names) for w weeks, so that a student never coöperates with the same student in two different weeks. Assume that n is even.
Examp开发者_StackOverflow社区le:
class: students 1,2,3,4
weeks: 3
- schedule for week 1: (1,2), (3,4)
- schedule for week 2: (1,3), (2,4)
- schedule for week 3: (2,3), (1,4)
I figured that w has to be smaller than or equal to n - 1 because every student can maximally coöperate with n - 1 others. But I don't know if there are always n - 1 solutions. If there are, I would like to see the algoritm that generates these n - 1 solutions in a none-brute force way.
Is there a name for this problem and a common algorithm I should look at?
Sounds like it is equivalent to a round robin tournament.
精彩评论