PDA

View Full Version : BubbleSort with 2 dimensional


kizla
22/10/2013, 06:38 PM
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:


//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;
}