Created
July 5, 2012 08:40
-
-
Save ryuichimatsumoto-single/3052341 to your computer and use it in GitHub Desktop.
function_bubble_sort
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
void bubble_sort(int a[],int n) | |
{ | |
int i;//ループ用変数 | |
int j;//ループ用変数 | |
int tmp;//交換用変数 | |
for(i=0;i<n;i++){ | |
for(j=(n-1);j>i;j--){ | |
if(a[j-1] > a[j]){ | |
tmp = a[j]; | |
a[j] = a[j-1]; | |
a[j-1] = tmp; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment