22.10.2013, 18:38
soo i have a problem with BubbleSort method, it works great while i have a 1 dimensional array, but what when i have 2 dimensional? example: "PlayerInfo[playerid][Kills]" how to sort it by order?
Here i have some example which i use for 1 dimensional:
Here i have some example which i use for 1 dimensional:
pawn Код:
//Credits iPS Bruno
BubbleSort(Array[], iSize)
{
new
iLoop = 0x0,
iCircuito = 0x0,
iTemp = 0x0;
while(++iLoop < iSize)
{
iCircuito = (-1);
while(++iCircuito < iLoop)
iTemp =
((Array[iLoop] > Array[iCircuito] ) ? ( iTemp = Array[iLoop], Array[iLoop] = Array[iCircuito], Array[iCircuito] = iTemp) : (0x0));
}
return Array;
}