一道算法题。

这篇博客讨论了一道关于锦标赛排序的算法题,其中给定了一种比较团队实力的二维数组w和一个表示比赛顺序的一维数组order。博主分享了C语言实现的代码,通过循环和比较找到每轮比赛的胜者,最终输出比赛结果数组。博客邀请读者阅读并交流思路,共同学习。
摘要由CSDN通过智能技术生成
题目是这样的:
N team competitions, numbered 0,1,2 respectively. . . . N-1, known comparison of strength of relationship, stored in a two-dimensional array w[n][n ], w[i][j ] represents the value of a number i,j in the team stronger. So w[i][j]=i or j, now gives the order of their appearance, and stored in the array order[n ], for example, order[n]={4,3,5,8,1 ... ... }, Then the first round of the competition is 4 to 3,5 to 8. ... ....
Programming, give a two-dimensional array w, a one-dimensional array of rank order and is used to output matches the array result[n ], find the result.


    题目说得不明不白的,我的理解是锦标赛排序,只不过是有限制条件的“give a two-dimensional array w”。实现代码如下:C语言:
while(int t=0; t<n; t++)//***********************************O(n)**************
{
    for (int m=0; m<n;m++)//用一个循环,先复制order[]到result[].
	{
	  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值