Kod: Zaznacz cały
class InsertionSort
{
static int LiczbaInwersjiInsertion = 0;
static int LiczbaInwersjiIplus1Inserrtion = 0
static int LiczbaPorownanInsertion = 0;
public void InsertionSort( int InsertionSort[] )
{
for ( int i = 0; i < InsertionSort.length; i++ )
{
for ( int j = i; j > 0; j-- )
{
if ( InsertionSort[ j-1 ] > InsertionSort[ j ] )
{
LiczbaPorownanInsertion++;
int bufor = InsertionSort[ j ];
InsertionSort[ j ] = InsertionSort[ j-1 ];
InsertionSort[ j-1 ] = bufor;
}
}
}
}
}