Planning a competition
Posted
by Jérôme
on Stack Overflow
See other posts from Stack Overflow
or by Jérôme
Published on 2010-05-31T07:07:53Z
Indexed on
2010/05/31
7:12 UTC
Read the original article
Hit count: 255
algorithm
I need to produce the schedule of a sport-event.
There are 30 teams. Each team has to play 8 matches. This means that it is not possible for each team to compete again all other teams, but I need to avoid that two team compete more than once against each other.
My idea was to generate all possible matches (for 30 teams: (30*29)/2 = 435 matches
) and select from this list 120 matches (8 match for each team: 8 * 30 / 2 = 120 matches
).
This is where I'm having a hard time: how can I select these 120 matches? I tried some simple solutions (take first match of the list, then the last, and so on) but they don't seem to work with 30 teams. I also tried to generate all possible match combination and find which one is working but with 30 team, this is too much calculation time.
Is there an existing algorithm that I could implement?
© Stack Overflow or respective owner