SOLIDKSINGH
Programmer
Plese send me the code for the following program.....
Write a scheduling program that schedules singles tennis matches among P players
over W weeks. The program must ensure that no one player P1 is assigned to
player P2 if there exists another player P3 who has played P1 fewer times. In
general, no repeat matches should occur while there are other matchups possible
that have occurred fewer times.
Consider the use of 2D arrays to keep track of the number of times each matchup
has occurred. For instance, when players P1 and P3 play, increment a counter in
(row1, column3) and (row3, column1).
The entries in row P denote the number of matchups that have occurred between
player P and each other player. Before assigning a matchup between P1 and Pn,
verify that no other matchup between P1 and Pj occurred fewer times.Use
(rand () %P+1) to select a player. You may also want to use a 1D array of P
elements to keep track if a player has been assigned yet for the current week.
Prompt the user for the number of players (<10) and the number of weeks (<52).
Try 6 players and 32 weeks. For each week, print the week number, and the
pair of players. For instance, print:
Week1: (1,3), (2,4), (5,6)
Week2: (1,2), (3,5), (4,6)
...
...
Also, print the contents of your 2-D array after the printout above.
This will confirm that all matchups occur the same number of times.
Write a scheduling program that schedules singles tennis matches among P players
over W weeks. The program must ensure that no one player P1 is assigned to
player P2 if there exists another player P3 who has played P1 fewer times. In
general, no repeat matches should occur while there are other matchups possible
that have occurred fewer times.
Consider the use of 2D arrays to keep track of the number of times each matchup
has occurred. For instance, when players P1 and P3 play, increment a counter in
(row1, column3) and (row3, column1).
The entries in row P denote the number of matchups that have occurred between
player P and each other player. Before assigning a matchup between P1 and Pn,
verify that no other matchup between P1 and Pj occurred fewer times.Use
(rand () %P+1) to select a player. You may also want to use a 1D array of P
elements to keep track if a player has been assigned yet for the current week.
Prompt the user for the number of players (<10) and the number of weeks (<52).
Try 6 players and 32 weeks. For each week, print the week number, and the
pair of players. For instance, print:
Week1: (1,3), (2,4), (5,6)
Week2: (1,2), (3,5), (4,6)
...
...
Also, print the contents of your 2-D array after the printout above.
This will confirm that all matchups occur the same number of times.