|Problems? Is your data what you think it is?|
Re: Round robin tournament problemby blokhead (Monsignor)
|on Oct 22, 2003 at 00:17 UTC||Need Help??|
Update 2: The first half of this post was found to be wrong, and lived inside <strike> tags for a long time. Now it's in HTML comments..
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 edge-colorings of complete graphs. In any case, the solution is certainly not NP-complete, 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!