10.12.2014, 00:43
pawn Код:
stock quickSort(array[], index[], tempvar, tempsize, desc)
{
new pivot, temp, var, i;
if(tempvar < tempsize)
{
pivot = tempvar;
var = array[pivot];
for(i = tempvar + 1; i <= tempsize; i ++)
{
if(desc ? (array[i] > var) : (array[i] < var))
{
pivot ++;
temp = array[i];
array[i] = array[pivot];
array[pivot] = temp;
temp = index[i];
index[i] = index[pivot];
index[pivot] = temp;
}
}
temp = array[tempvar];
array[tempvar] = array[pivot];
array[pivot] = temp;
temp = index[tempvar];
index[tempvar] = index[pivot];
index[pivot] = temp;
quickSort(array, index, tempvar, pivot - 1, desc);
quickSort(array, index, pivot + 1, tempsize, desc);
}
}
pawn Код:
quickSort(aScoreInfo[eScoreInfo], aScoreInfo[score], 0, countex, true);