cout << "*** bubble sort ***" << "\n" << "\n";
for( i = 0 ; i < y ; i ++)
{
for( j = 0; j < x ; j ++ )
{
cout << " " << matrix_bubble[i][j] << " ";
}
cout << endl;
}
cout << "\n";
cout << "counter = " << counter << "\n"<<"\n";
//------------------------------ ñîðòèðîâêà ìåòîäîì Øåëêà ----------------------------------------
for(int h = 0; h <= y ; h = h+1);
for( ; h > 0; h -= 1)
for(i = h; i <= y; i++)
{
j = i;
while(j >= h && (shellk[i] > shellk[j-h]))
{
shellk[j] = shellk[j-h];
j -=h;
}
shellk[j] = shellk[i];
}
cout << "*** Shellk sort ***" << "\n" << "\n";
for(i = 0 ; i < y ; i ++)
{
for(j = 0; j < x ; j ++ )
{
cout << " " << matrix_shellk[i][j] << " ";
}
cout << endl;
}
cout << "\n";
cout << "counter = " << counter << "\n"<<"\n";
//------------------------------ áûñòðàÿ ñîðòèðîâêà ----------------------------------------------
counter = 0;
int summ = 0;
int t;
int counter_quick1 = 0;
int counter_quick2 = 0;
for (i = 0; i < y; i++)
summ += massive[i];
int center = summ / y;
for (i = 0, j = 0, t = 0; t < y; t++)
{
if (massive[t] > center)
counter_quick1++;
else
counter_quick2++;
}
for (i = 0, j = 0, t = 0; t < y; t++)
{
if (massive[t] > center)
{
quick1[i] = massive[t];
for (g = 0; g < x; g++)
{
matrix_quick1[i][g] = matrix[t][g];
}
i++;
}
else
{
quick2[j] = massive[t];
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.