From e3039d45f32adcbac55d745197aa67e2d487bb6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=B3=E5=AD=90=E6=9D=B0?= <14285364+jinzj_828@user.noreply.gitee.com> Date: Wed, 10 Apr 2024 17:30:22 +0800 Subject: [PATCH 1/2] =?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/Jinzj_828/15842649id.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 codes/Jinzj_828/15842649id.java diff --git a/codes/Jinzj_828/15842649id.java b/codes/Jinzj_828/15842649id.java new file mode 100644 index 000000000..8e911f6b3 --- /dev/null +++ b/codes/Jinzj_828/15842649id.java @@ -0,0 +1,18 @@ +/** + * 冒泡排序函数 + * @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]) { + // 交换位置 + int temp = a[j]; + a[j] = a[j + 1]; + a[j + 1] = temp; + } + } + } +} //end + -- Gitee From 016fa017c2584bcde7f60faf597e94ade84c30ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=B3=E5=AD=90=E6=9D=B0?= <14285364+jinzj_828@user.noreply.gitee.com> Date: Wed, 10 Apr 2024 17:53:22 +0800 Subject: [PATCH 2/2] =?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 --- activity-school | 2 +- codes/Jinzj_828/15842649.java | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 codes/Jinzj_828/15842649.java diff --git a/activity-school b/activity-school index f2ff53330..e3039d45f 160000 --- a/activity-school +++ b/activity-school @@ -1 +1 @@ -Subproject commit f2ff5333080150375ce51b4e81fe60feff5907cf +Subproject commit e3039d45f32adcbac55d745197aa67e2d487bb6f diff --git a/codes/Jinzj_828/15842649.java b/codes/Jinzj_828/15842649.java new file mode 100644 index 000000000..8e911f6b3 --- /dev/null +++ b/codes/Jinzj_828/15842649.java @@ -0,0 +1,18 @@ +/** + * 冒泡排序函数 + * @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]) { + // 交换位置 + int temp = a[j]; + a[j] = a[j + 1]; + a[j + 1] = temp; + } + } + } +} //end + -- Gitee