int []a={70,53,57,28,30,77,1,76,81,70};
int nlen = a.Length;
int gap = nlen / 2;
int temp;
while (gap > 0)
{
for (int i = 0; i < nlen-gap; i++)
{
int j = i + gap;
if (a[i] < a[j])
{
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
int nlen = a.Length;
int gap = nlen / 2;
int temp;
while (gap > 0)
{
for (int i = 0; i < nlen-gap; i++)
{
int j = i + gap;
if (a[i] < a[j])
{
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
gap = gap / 2;
结果:81;77;76;70;70;57;53;28;30;1
求解???为什么是这样,哪里有问题啊??