一个C冒泡排序算法

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];
}
}
}
}

你可能感兴趣的:(C++,排序,冒泡)