Pathologically Eclectic Rubbish Lister  
PerlMonks 
Re: Round robin tournament problemby blokhead (Monsignor) 
on Oct 22, 2003 at 00:17 UTC ( #301122=note: print w/ replies, xml )  Need Help?? 
Update 2: Wouldn't you know it, in combinatorics class today we actually discussed this exact problem. It has an analogous problem in graph theory dealing with edgecolorings of complete graphs. In any case, the solution is certainly not NPcomplete, and the algorithm is very simple with a visual explanation.. Make a circle out of the competitors, except put one player in the middle. For each round, match up the middle guy with someone, then match up the other ones in a symmetric. It's easier to understand what I mean by "symmetric" with a picture, so here's an example with n=8: You obviously never get duplicates with the person you put in the middle. But you will also never get duplicates with the other people in the circle, because there are an odd number of them to pair up. You won't get duplicates until you've rotated all the way around. Doing this in code is pretty easy: Yay combinatorics class! blokhead
In Section
Seekers of Perl Wisdom

