From 58e6ca1d08cf1e5617f979a05432687123b3db0f Mon Sep 17 00:00:00 2001 From: Wang Tiaoke <960485902@qq.com> Date: Wed, 14 May 2025 09:46:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=92=E5=BA=8F=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- codes/wangtiaoke/20510324.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 codes/wangtiaoke/20510324.java diff --git a/codes/wangtiaoke/20510324.java b/codes/wangtiaoke/20510324.java new file mode 100644 index 000000000..296f54517 --- /dev/null +++ b/codes/wangtiaoke/20510324.java @@ -0,0 +1,11 @@ +public static void bubbleSort(int[] a, int n) { + for (int j = n - 1; j > 0; j--) { + for (int i = 0; i < j; i++) { + if (a[i] > a[i + 1]) { + int temp = a[i]; + a[i] = a[i + 1 ]; + a[i + 1] = temp; + } + } + } +} -- Gitee