BubbleSort with 2 dimensional
#1

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:

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


Forum Jump:


Users browsing this thread: 1 Guest(s)