多个项目之间的排序算法而不仅仅是两个项目(篮球)之间的排序算法?
我们需要对篮球队进行分类。
作为参考,程序如下:
D.1 Procedure
Teams shall be classified according to their win-loss records, namely two (2) points
for each game won, one (1) point for each game lost (including lost by default) and
zero (0) points for a game lost by forfeit.
D.1.1 If there are two (2) teams in the classification with equal points, the result(s) of the
game(s) between the two (2) teams involved will be used to determine the placing.
D.1.2 If the points and the goal average in the games between the two (2) teams are still
the same, the classification will be determined by the goal average of all the games
played in the group by each team.
D.1.3 If there are more than two (2) teams in the classification with equal points, a second
classification will be established, taking into account only the results of the games
between the involved teams.
D.1.4 If at any stage of this procedure the number of teams with equal points is reduced
to only two (2) teams, the procedure in D.1.1 and D.1.2 above will be applied.
D.1.5 If in the second classification there are still teams with equal points, the goal
average will be used to determine the placing, taking into account only the results
of the games between the involved teams.
D.1.6 If there are still more than two (2) teams with the same goal average, the placing
will be determined using the goal average from the results of all their games played
in the group.
D.1.7 If at any stage of this procedure the number of teams with equal points is reduced
to a tie still involving more than two (2) teams, the procedure, beginning with D.1.3
above, is repeated.
D.1.8 Goal average will always be calculated by division.
问题是如何处理 D.1.3 部分,该部分表示:如果分类中有两 (2) 支以上球队得分相同,则第二支球队 将仅考虑比赛结果来确定分类
如何对第二分类进行建模以及如何根据他们之间的比赛结果做出决策?
We need to do the basketball team classification.
For reference the procedure is here:
D.1 Procedure
Teams shall be classified according to their win-loss records, namely two (2) points
for each game won, one (1) point for each game lost (including lost by default) and
zero (0) points for a game lost by forfeit.
D.1.1 If there are two (2) teams in the classification with equal points, the result(s) of the
game(s) between the two (2) teams involved will be used to determine the placing.
D.1.2 If the points and the goal average in the games between the two (2) teams are still
the same, the classification will be determined by the goal average of all the games
played in the group by each team.
D.1.3 If there are more than two (2) teams in the classification with equal points, a second
classification will be established, taking into account only the results of the games
between the involved teams.
D.1.4 If at any stage of this procedure the number of teams with equal points is reduced
to only two (2) teams, the procedure in D.1.1 and D.1.2 above will be applied.
D.1.5 If in the second classification there are still teams with equal points, the goal
average will be used to determine the placing, taking into account only the results
of the games between the involved teams.
D.1.6 If there are still more than two (2) teams with the same goal average, the placing
will be determined using the goal average from the results of all their games played
in the group.
D.1.7 If at any stage of this procedure the number of teams with equal points is reduced
to a tie still involving more than two (2) teams, the procedure, beginning with D.1.3
above, is repeated.
D.1.8 Goal average will always be calculated by division.
The question is how to approach the D.1.3 section, which says: If there are more than two (2) teams in the classification with equal points, a second
how to model the second classification and how to make the decision based on the results of the games between them?
classification will be established, taking into account only the results of the games
between the involved teams.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
对于积分相同的 k 支球队,构建一个较小的“联赛表”,大小为 k,其中仅根据这些球队之间的比赛来填充积分和进球数。
在这个较小的表上递归地激活排名过程。
如果两次递归调用之间没有队伍减少(队伍完全相等)或建立了完整排名,则停止。如果名单由两支积分相同的球队组成:则适用次要标准。
For k teams with equal points, construct a smaller "league table", of size k, which will be populated with points and goals based only on the games between these teams.
Activate the ranking procedure recursively on this smaller table.
Halt if there is no team was reduced between 2 recursive calls [the teams are completely equal] or when a full ranking was established. If list consists of two teams only with same points: secondary criteria applies.
您的比较器可以参考团队列表。即使在调用过程 D.1.3 的情况下,它也能够比较两个元素。
Your Comparator could have a reference to the List of teams. It would then be able to compare the two elements even in the event Procedure D.1.3 is invoked.
按照您在现实生活中的做法进行操作:
Do this how you would do it in real life:
您可以使用 BogoSort 来实现此目的。
List
是否根据过程正确排序。那么你的代码将如下所示。
无效排序(列出团队)
{
while (!验证器.有效(团队))
{
收藏。洗牌(团队);
}
}
You can use BogoSort for this.
List<Team>
is sorted correctly according to the procedures.Then your code will look like this.
void sort ( List teams )
{
while ( ! validator . valid ( teams ) )
{
Collections . shuffle ( teams ) ;
}
}