From ac7dd4776436efa567abb232dfc3704a029a22d3 Mon Sep 17 00:00:00 2001 From: liuqi-open <13129172+liuqi-open@user.noreply.gitee.com> Date: Wed, 28 Jun 2023 01:06:07 +0000 Subject: [PATCH] =?UTF-8?q?issue=5F12515585=20add=20SevenHLiu/12515585.jav?= =?UTF-8?q?a.=20=E6=B7=BB=E5=8A=A0=E5=86=92=E6=B3=A1=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuqi-open <13129172+liuqi-open@user.noreply.gitee.com> --- SevenHLiu/12515585.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 SevenHLiu/12515585.java diff --git a/SevenHLiu/12515585.java b/SevenHLiu/12515585.java new file mode 100644 index 0000000..8873249 --- /dev/null +++ b/SevenHLiu/12515585.java @@ -0,0 +1,18 @@ +/** + * 冒泡排序函数 + * 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 - i - 1; j++) { + if (a[j] > a[j + 1]) { + int tmp = a[j + 1]; + a[j + 1] = a[j]; + a[j] = tmp; + } + } + } +} //end \ No newline at end of file -- Gitee