From 4b03abb3c6f841777df88abf9cfd816b8bff0c14 Mon Sep 17 00:00:00 2001 From: sxy <1432029861@qq.com> Date: Wed, 29 May 2024 15:49:16 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- codes/s18893442896/9622480.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 codes/s18893442896/9622480.java diff --git a/codes/s18893442896/9622480.java b/codes/s18893442896/9622480.java new file mode 100644 index 000000000..d2c489e64 --- /dev/null +++ b/codes/s18893442896/9622480.java @@ -0,0 +1,20 @@ +/** + * 冒泡排序函数 + * aa bb cc + * @param a 待排序的数组 + * @param n 待排序的数组长度 + */ +public static void bubbleSort(int [] a, int n){ + if (array == null || n <= 1) { + return; + } + for (int i = 0; i < n - 1; i++) { + for (int j = 0; j < n - i - 1; j++) { + if (array[j] > array[j + 1]) { + int temp = array[j]; + array[j] = array[j + 1]; + array[j + 1] = temp; + } + } + } +} -- Gitee From 29558615dcd0c532bb5eb406b45db1155fe16a45 Mon Sep 17 00:00:00 2001 From: sxy <1432029861@qq.com> Date: Wed, 29 May 2024 16:16:08 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- codes/s18893442896/{9622480.java => 16477528.java} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename codes/s18893442896/{9622480.java => 16477528.java} (100%) diff --git a/codes/s18893442896/9622480.java b/codes/s18893442896/16477528.java similarity index 100% rename from codes/s18893442896/9622480.java rename to codes/s18893442896/16477528.java -- Gitee From 36f093cbcbc0ef606db43527fd29d924eedf1cfe Mon Sep 17 00:00:00 2001 From: sxy <1432029861@qq.com> Date: Wed, 29 May 2024 16:32:41 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- codes/s18893442896/16477528.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/codes/s18893442896/16477528.java b/codes/s18893442896/16477528.java index d2c489e64..4324a2399 100644 --- a/codes/s18893442896/16477528.java +++ b/codes/s18893442896/16477528.java @@ -17,4 +17,7 @@ public static void bubbleSort(int [] a, int n){ } } } + for (int num : array) { + System.out.print(num + " "); + } } -- Gitee