#include<stdio.h>
int main(void)
{
int number[5] = {12,35,99,18,76};
int i,t,j;
for(j = 0; j < 5; j++){
for (i = 0; i < 5-j-1; i++){
if(number[i] < number[i+1]){
t = number[i];
number[i] = number[i+1];
number[i+1] = t;
}
}
}
for(i = 0; i < 5; i++)
printf("%d\t", number[i]);
return 0;
}
冒泡排序的時(shí)間復(fù)雜度為O(N^2)