Javaでバブルソートの実装サンプル

Javaコード
public static void cftbubble(int a[]) {
int swap = 0;
for (int i = 0; i < a.length; i++) {
for (int j = i; j < a.length; j++) {
if (a[j] > a[i]) {
swap = a[i];
a[i] = a[j];
a[j] = swap;
}
}
}
System.out.println(Arrays.toString(a));
}

Java

Posted by arkgame