摘要:
Java Code:class Class1{static void bubbleSort(int[] a){for (int j = a.length - 1; j > 0; j--) // outer loop (backward)for (int i = 0; i < j; i++) // inner loop (forward)if (a[i] > a[i+1]) //Swap{a[i] = a[i] + a[i+1];a[i+1] = a[i] - a[i+1];a[i] = a[i] - a[i+1];}}public static void main(Strin 阅读全文