-
-
Save wdfx100/4224201 to your computer and use it in GitHub Desktop.
冒泡排序
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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