Question: Using the following information, please simulate how MakeRanking behaves on the W given in the beginning of this question text. It suffices that you list
Using the following information, please simulate how MakeRanking behaves on the given
in the beginning of this question text. It suffices that you list the result of each call to
MergeRankings.
Consider a tennis tournament where each of the participants numbered plays every
other player exactly once; each such match will result in a victory for one of the players, as
recorded in the table where if player i won the match against player
and otherwise.
Our goal is to produce a ranking of all players, where a ranking is defined as a list
with of different players each in such that for all iin won the match
against Such a ranking may be disputed since, eg may have lost all matches
except the one against
To illustrate, let us consider the table given above.
Then is a ranking since player beat player is a ranking, and even
is a ranking since player beat player who beat player who beat
player
It turns out perhaps surprisingly that there will always exist at least one ranking. This is
due to the fact that it is always possible to merge rankings for two disjoint set of players into
a ranking of the union of those players. For the above matches, we can for example merge
and : not by putting one in front of the other, since neither nor are
valid rankings, but into
We shall now develop a general algorithm, taking a table as implicit parameter,
for finding a ranking of players.
We shall first present an auxiliary algorithm MergeRankings that given disjoint rankings
and with and produces a specific ranking such that if
player is ranked higher than player in or in then is ranked higher than in The
algorithm is given by the code
MergeRankings jlarr
while or if
jlarrj
else if
ilarri
else if
larrB
else
larrA
ilarri
We can now write an algorithm MakeRanking that is based on the Divide & Conquer
paradigm, uses MergeRankings, and which constructs a ranking of the players lo hiWhen
called with MakeRanking thus returns a ranking of all the players.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
