function combSorting(array) {
var interval = Math.floor(array.length / 1.3);
while (interval > 0) {
for(var i = 0; i + interval < array.length; i++) {
if (array[i] > array[i + interval]) {
var small = array[i + interval];
array[i + interval] = array[i];
array[i] = small;
}
}
interval = Math.floor(interval / 1.3);
}
}
1233 byte[] bytes = File.ReadAllBytes("file.txt");
это блок с кодом byte[] bytes = File.ReadAllBytes("file.txt");
ulong gap = (ulong)bytes.Length;
bool swapped = false;
while ((gap > 1) || swapped)
{
gap = (ulong)(gap / 1.2473309);
if (gap < 1) gap = 1;
ulong i = 0;
ulong m = gap;
swapped = false;
while (m < (ulong)bytes.Length)
{
if (bytes[i] > bytes[m])
{
swapped = true;
byte t = bytes[i];
bytes[i] = bytes[m];
bytes[m] = t;
}
i++;
m = i + gap;
}
}