Compare commits

..

No commits in common. '冒泡排序' and 'master' have entirely different histories.

@ -1,34 +0,0 @@
//复杂度O(N^2)
//时间1.19s
#include<stdio.h>
void bubble(int a[],int n)
{
int i,j,t;
for(i=1;i<n;i++)
{
for(j=0;j<n-i;j++)
{
if(a[j]>a[j+1])
{
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
}
}
}
int main(void)
{
int n;
scanf("%d",&n);
int b[n];
for(int i=0;i<n;i++)
{
scanf("%d",&b[i]);
}
bubble(b,n);
for(int i=0;i<n;i++)
{
printf("%d",b[i]);
}
}
Loading…
Cancel
Save