Skip to content

Instantly share code, notes, and snippets.

@wdfx100
Created December 6, 2012 12:44
Show Gist options
  • Save wdfx100/4224201 to your computer and use it in GitHub Desktop.
Save wdfx100/4224201 to your computer and use it in GitHub Desktop.
冒泡排序
int temp;
for(int i=0;i<num.length-1;i++){
for(int j=0;j<num.length-i-1;j++){
if(num[j]>num[j+1]){
temp=num[j];//大的先拿出来
num[j]=num[j+1];//小的往前移
num[j+1]=temp;//大的往后移
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment