Given this:
鉴于这种:
int areas[20];
for (int i = 0; i < 20; i++)
{
areas[i] = detectedBlobs[i].getWidth() * detectedBlobs[i].getHeight();
}
I understand how to sort arrays and find the first, second, third, etc. largest values, but how can I find the index values associated with the first, second or third largest values?
我理解如何对数组进行排序并找到第一个,第二个,第三个等最大值,但是如何找到与第一个,第二个或第三个最大值相关联的索引值?
1 个解决方案
#1
1
As you already know how to find the largest value in a sorted array, the next step would be enumerate through unsorted array and compare each object with largest value if matches you can get the index of it! –
正如您已经知道如何在排序数组中找到最大值,下一步将通过未排序数组进行枚举,并将每个对象与最大值进行比较,如果匹配则可以得到它的索引! -
#1
1
As you already know how to find the largest value in a sorted array, the next step would be enumerate through unsorted array and compare each object with largest value if matches you can get the index of it! –
正如您已经知道如何在排序数组中找到最大值,下一步将通过未排序数组进行枚举,并将每个对象与最大值进行比较,如果匹配则可以得到它的索引! -