从n个列表中生成灯具 [英] Generating Fixtures from a list of n

查看:74
本文介绍了从n个列表中生成灯具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有N个球队,以及要生成一份固定名单的东西,每个球队与其他球队一起比赛,什么是最佳做法?有一个已知的算法可以很好地做到这一点吗?效率并不是真正必要的,因为每个季节只需生成一次即可.

Suppose I have N teams and what to generate a fixture list, where every team plays every other team, what is the best practice for this. Is there a known algorithm that does this nicely? Efficiency isn't really a necessity as this only needs to be generated once a season.

更具体地说,我将从一些定义开始: 我有N支队伍... T_1,T_2,...,T_n.如果N为奇数,则包括一个幽灵"团队以使团队数量均匀. 一周的一组固定装置是一组N/2对,没有一组以上的一对. 固定装置列表"是一组固定装置,以使每个团队与每个其他团队配对.

To be more specific, I'll start with some definitions: I have N teams... T_1, T_2, ... , T_n. If N is odd, include a 'ghost' team to make the amount of teams even. A set of fixtures for a week is a set of N/2 pairs, with no team in more than one pair. A 'fixture list' is set of sets of fixtures such that every team is paired with every other team.

我想要做的是创建一个带有某种随机元素的灯具列表". 谢谢

What I am trying to do is create a 'fixture list' with some kind of random element to it. Thanks

推荐答案

此处是通常的方式.如果您需要一些随机元素,则可以先洗牌 .没关系,因为每个团队都可以互相比赛.

Here is the usual way. If you need some random element, you can shuffle the list of teams first. It doesn't matter much, since every team plays every other anyway.

这篇关于从n个列表中生成灯具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆