diff --git a/codes/nianqi/.15782083.java.swp b/codes/nianqi/.15782083.java.swp new file mode 100644 index 0000000000000000000000000000000000000000..b5d9f4be7820c66180d1a05079f4ce092f96836f Binary files /dev/null and b/codes/nianqi/.15782083.java.swp differ diff --git a/codes/nianqi/15782083.java b/codes/nianqi/15782083.java new file mode 100644 index 0000000000000000000000000000000000000000..4dd4be5948049084b04a2fbea44c62897c23fc49 --- /dev/null +++ b/codes/nianqi/15782083.java @@ -0,0 +1,29 @@ +/tic void bubbleSort(int[] a, int n) { + for (int i = 0; i < n - 1; i++) { // 外层循环控制所有元素 + for (int j = 0; j < n - 1 - i; j++) { // 内层循环负责两两比较 + if (a[j] > a[j + 1]) { // 如果前一个元素大于后一个元素,则交换它们 + // 交换 a[j] 和 a[j + 1] + // int temp = a[j]; + // a[j] = a[j + 1]; + // a[j + 1] = temp; + // } + // } + // } + // } // end** + * 冒泡排序函数 + * 将一个无序的数组按照从小到大的顺序进行排序 + * @param a 待排序的数组 + * @param n 待排序的数组长度 + */ +public static void bubbleSort(int[] a, int n) { + for (int i = 0; i < n - 1; i++) { // 外层循环控制所有元素 + for (int j = 0; j < n - 1 - i; j++) { // 内层循环负责两两比较 + if (a[j] > a[j + 1]) { // 如果前一个元素大于后一个元素,则交换它们 + // 交换 a[j] 和 a[j + 1] + int temp = a[j]; + a[j] = a[j + 1]; + a[j + 1] = temp; + } + } + nstall curl-devel expat-devel gettext-devel openssl-devel zlib-develyum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-develyum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-develyum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-develyum -y install gitgit --versioncd activity-schoolcd activity-schoolcd codes} +} // end