diff --git a/codes/Riemann/.16240070.java.swp b/codes/Riemann/.16240070.java.swp new file mode 100644 index 0000000000000000000000000000000000000000..fa8341a77495da9199906a173c392594bfde3b86 Binary files /dev/null and b/codes/Riemann/.16240070.java.swp differ diff --git a/codes/Riemann/.java.swp b/codes/Riemann/.java.swp new file mode 100644 index 0000000000000000000000000000000000000000..834aae1581368a65c5e4c832e3eed8728b096901 Binary files /dev/null and b/codes/Riemann/.java.swp differ diff --git a/codes/Riemann/16240070.java b/codes/Riemann/16240070.java new file mode 100644 index 0000000000000000000000000000000000000000..86c0b8a1e716c5c79ca7b7220be01a370763e094 --- /dev/null +++ b/codes/Riemann/16240070.java @@ -0,0 +1,27 @@ +/** + * 冒泡排序函数 + * aa bb cc + * @param a 待排序的数组 + * @param n 待排序的数组长度 + */ +public static void bubbleSort(int [] a, int n){ + // 你的代码,使无序数组 a 变得有序 + int n = arr.length; + for (int i = 0; i < n-1; i++) + for (int j = 0; j < n-i-1; j++) + if (arr[j] > arr[j+1]) { + // 交换 arr[j+1] 和 arr[j] + int temp = arr[j]; + arr[j] = arr[j+1]; + arr[j+1] = temp; + } + } + + /* 函数用于打印数组 */ + static void printArray(int arr[]) { + for (int i=0; i < arr.length; i++) + System.out.print(arr[i] + " "); + System.out.println(); + } + +} //end