多个项目之间的排序算法而不仅仅是两个项目(篮球)之间的排序算法?

发布于 2024-12-17 05:49:34 字数 1835 浏览 0 评论 0原文

我们需要对篮球队进行分类。

作为参考,程序如下:

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
classification will be established, taking into account only the results of the games
between the involved teams.
how to model the second classification and how to make the decision based on the results of the games between them?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

尝蛊 2024-12-24 05:49:34

对于积分相同的 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.

卸妝后依然美 2024-12-24 05:49:34

您的比较器可以参考团队列表。即使在调用过程 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.

棒棒糖 2024-12-24 05:49:34

按照您在现实生活中的做法进行操作:

  1. 使用比较条件列表对团队进行排序
  2. ,对列表进行排序后,对其进行遍历,看看是否有 3 个以上的团队并列。
  3. 每当您发现这样一组 3 个以上的平局时,这次使用不同的设定标准来解决它。

Do this how you would do it in real life:

  1. Sort the teams using a list of criteria to compare them
  2. After the list is sorted, do a pass over it to see if there are any runs of 3+ teams that are tied.
  3. Whenever you find such a group of 3+ ties, resolve it using a different set criteria this time.
夜雨飘雪 2024-12-24 05:49:34

您可以使用 BogoSort 来实现此目的。

  1. 将所有团队存储在列表中。
  2. 创建一个验证器,用于确定 List 是否根据过程正确排序。
  3. 那么你的代码将如下所示。

    无效排序(列出团队)
    {
    while (!验证器.有效(团队))
    {
    收藏。洗牌(团队);
    }
    }

You can use BogoSort for this.

  1. Store all teams in a List.
  2. Create a validator that determines whether or not a List<Team> is sorted correctly according to the procedures.
  3. Then your code will look like this.

    void sort ( List teams )
    {
    while ( ! validator . valid ( teams ) )
    {
    Collections . shuffle ( teams ) ;
    }
    }

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文