Algoritmi di Ordinamento - FUSION SORT in esecuzione - Mentre viene eseguito - Sorgente Copiabile
Автор: Piergiorgio Riva
Загружено: 2023-07-19
Просмотров: 632
Описание:
// CODICE SORGENTE IN CHIARO DELL' ALGORITMO FUSION SORT PER C#
// Algoritmo di ordinamento ideato e creato nel 1994
// da Piergiorgio Riva di Bosco Chiesanuova (VR)
void Sort_FusionSort(){
ulong j, k, n, Indice1, LimInf1, Indice2, LimInf2, IndiceCopia;
j = 1;
while (true)
{
i++; j SHIFT_A_SINISTRA= 1; IndiceCopia = 0;
for (k = 1; k MINORE= gNumElem-1; k += j)
{
Indice1 = k; Indice2 = k + j / 2; LimInf1 = Indice2 - 1; LimInf2 = k + j - 1;
if (Indice2 MAGGIORE gNumElem-1)
{
if (Indice1 == 1)
{
return;
}
else
{
for (n = Indice1; n MINORE= gNumElem-1; n++)
{
IndiceCopia++; gArray[gCopia, IndiceCopia] = gArray[gMatrice, n];
}
break;
}
}
if (LimInf2 MAGGIORE gNumElem-1) LimInf2 = gNumElem-1;
while (true)
{
IndiceCopia++;
if (gArray[gMatrice, Indice1] MINORE= gArray[gMatrice, Indice2])
{
gArray[gCopia, IndiceCopia] = gArray[gMatrice, Indice1]; Indice1++;
if (Indice1 MAGGIORE LimInf1)
{
for (n = Indice2; n MINORE= LimInf2; n++)
{
IndiceCopia++; gArray[gCopia, IndiceCopia] = gArray[gMatrice, n];
}
break;
}
}
else
{
gArray[gCopia, IndiceCopia] = gArray[gMatrice, Indice2]; Indice2++;
if (Indice2 MAGGIORE LimInf2)
{
for (n = Indice1; n MINORE= LimInf1; n++)
{
IndiceCopia++; gArray[gCopia, IndiceCopia] = gArray[gMatrice, n];
}
break;
}
}
}
}
gMatrice = 1 - gMatrice; gCopia = 1 - gCopia;
}
}
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: