Console.WriteLine("shejker");
for (int i = 0; i < a.Length; i++)
{ b[i] = a[i]; }
col_sravn = 0;
col_per = 0;
while (l < r)
{ for (int i = r; i >= l; i--)
{
col_sravn++;
if (b[i - 1] > b[i])
{ temp = b[i - 1];
b[i - 1] = b[i];
b[i] = temp;
col_per++;
k = i; }
}
l = k + 1;
for (int i = l; i <= r; i++)
{
col_sravn++;
if (b[i - 1] > b[i])
{ temp = b[i - 1];
b[i - 1] = b[i];
b[i] = temp;
col_per++;
k = i;
}
}
r = k - 1;
}
for (int i = 0; i < b.Length; i++)
Console.Write("{0} ", b[i]);
Console.WriteLine();
Console.WriteLine("kol-vosrav {0}", col_sravn);
Console.WriteLine("kol-vo perestav {0}", col_per);
Console.ReadLine();