题目是这样的:
题目说得不明不白的,我的理解是锦标赛排序,只不过是有限制条件的“give a two-dimensional array w”。实现代码如下:C语言:
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[].
{