tideman.c
void sort_pairs(void)
{
    // Use Bubble Sort with breakout for improved efficiency for best case scenario

    for (int i = 0; i < pair_count; i++)
    {
        bool check = false;
        for (int j = 0; j < pair_count - i - 1; j++)
        {
            if (preferences[pairs[j].winner][pairs[j].loser] < preferences[pairs[j + 1].winner][pairs[j + 1].loser])
            {
                int temp1 = pairs[i].winner;
                int temp2 = pairs[i].loser;

                pairs[i].winner = pairs[i + 1].winner;
                pairs[i].loser = pairs[i + 1].loser;

                pairs[i + 1].winner = temp1;
                pairs[i + 1].loser = temp2;

                check = true;
            }
        }
        if (check == false)
        {
            break;
        }
    }
    //for (int i = 0; i < pair_count; i++)
    //{
    //     printf("%i : %i , strength: %i\n" ,pairs[i].winner, pairs[i].loser,preferences[pairs[i].winner][pairs[i].loser]);
    //}

    return;
}
// Sort pairs in decreasing order by strength of victory
Sort pairs in decreasing order by strength of victory
Sort pairs in decreasing order by strength of victory
void sort_pairs(void)
{
    for (int i = 0; i < pair_count; i++)
    {
        bool check = false;
        for (int j = 0; j < pair_count - i - 1; j++)
        {
            if (preferences[pairs[j].winner][pairs[j].loser] < preferences[pairs[j + 1].winner][pairs[j + 1].loser])
            {
                int temp1 = pairs[i].winner;
                int temp2 = pairs[i].loser;
                pairs[i].winner = pairs[i + 1].winner;
                pairs[i].loser = pairs[i + 1].loser;
                pairs[i + 1].winner = temp1;
                pairs[i + 1].loser = temp2;
                check = true;
            }
        }
        if (check == false)
        {
            break;
        }
    }
    return;
}
void sort_pairs ( void ) { for ( int i = 0 ; i < pair_count ; i ++ ) { bool check = false ; for ( int j = 0 ; j < pair_count - i - 1 ; j ++ ) { if ( preferences [ pairs [ j ] . winner ] [ pairs [ j ] . loser ] < preferences [ pairs [ j + 1 ] . winner ] [ pairs [ j + 1 ] . loser ] ) { int temp1 = pairs [ i ] . winner ; int temp2 = pairs [ i ] . loser ; pairs [ i ] . winner = pairs [ i + 1 ] . winner ; pairs [ i ] . loser = pairs [ i + 1 ] . loser ; pairs [ i + 1 ] . winner = temp1 ; pairs [ i + 1 ] . loser = temp2 ; check = true ; } } if ( check == false ) { break ; } } return ; }
Sort pairs in decreasing order by strength of victory
Sort pairs in decreasing order by strength of victory
// Use Bubble Sort with breakout for improved efficiency for best case scenario //for (int i = 0; i < pair_count; i++) //{ //     printf("%i : %i , strength: %i\n" ,pairs[i].winner, pairs[i].loser,preferences[pairs[i].winner][pairs[i].loser]); //}