From a1ae821a1b62c5758ad14a43e07b107b55370a66 Mon Sep 17 00:00:00 2001 From: "suiya.lhl" Date: Thu, 3 Nov 2022 02:48:15 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E6=B8=A9=E6=9A=96?= =?UTF-8?q?=E7=9A=84=E7=94=B5=E6=B3=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "codes/\346\270\251\346\232\226\347\232\204\347\224\265\346\263\242/.keep" diff --git "a/codes/\346\270\251\346\232\226\347\232\204\347\224\265\346\263\242/.keep" "b/codes/\346\270\251\346\232\226\347\232\204\347\224\265\346\263\242/.keep" new file mode 100644 index 00000000..e69de29b -- Gitee From 0b7839fab4f19dbbfbe1b34b39fb384108802473 Mon Sep 17 00:00:00 2001 From: "suiya.lhl" Date: Thu, 3 Nov 2022 02:49:55 +0000 Subject: [PATCH 2/2] =?UTF-8?q?add=20codes/=E6=B8=A9=E6=9A=96=E7=9A=84?= =?UTF-8?q?=E7=94=B5=E6=B3=A2/10040713.java.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: suiya.lhl --- .../10040713.java" | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 "codes/\346\270\251\346\232\226\347\232\204\347\224\265\346\263\242/10040713.java" diff --git "a/codes/\346\270\251\346\232\226\347\232\204\347\224\265\346\263\242/10040713.java" "b/codes/\346\270\251\346\232\226\347\232\204\347\224\265\346\263\242/10040713.java" new file mode 100644 index 00000000..29d27043 --- /dev/null +++ "b/codes/\346\270\251\346\232\226\347\232\204\347\224\265\346\263\242/10040713.java" @@ -0,0 +1,23 @@ +/** + * 冒泡排序函数 + * aa bb cc + * @param a 待排序的数组 + * @param n 待排序的数组长度 + */ +public static void bubbleSort(int [] a, int n){ + // 你的代码,使无序数组 a 变得有序 + for (int i = 0; i < n-1; i++) { + for (int j = 0; j < n-1-i; j++) { + if (a[j] >= a[j+1]) { + int temp = a[j]; + a[j] = a[j+1]; + a[j+1] = temp; + } + } + } + + System.out.print("冒泡排序的结果是: "); + for (int i : a) { + System.out.print(i + " "); + } +} //end \ No newline at end of file -- Gitee