void BubbleSort(int a[], int len)
{
int i, temp;
for(; len>=1; len--)
{
for(i=1; i<len; i++)
{
if(a[i-1] > a[i])
{
temp = a[i-1] + a[i];
a[i] = temp - a[i];
a[i-1] = temp - a[i];
}
}
}
}
{
int i, temp;
for(; len>=1; len--)
{
for(i=1; i<len; i++)
{
if(a[i-1] > a[i])
{
temp = a[i-1] + a[i];
a[i] = temp - a[i];
a[i-1] = temp - a[i];
}
}
}
}
转载于:https://blog.51cto.com/9070303/1540465