From c69c41d74897b5ceceb2a8808a518d07cb2ec2d1 Mon Sep 17 00:00:00 2001 From: guqi1234 <14276097+guqi1234@user.noreply.gitee.com> Date: Tue, 9 Apr 2024 11:54:17 +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/guqi123/15821287.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 codes/guqi123/15821287.java diff --git a/codes/guqi123/15821287.java b/codes/guqi123/15821287.java new file mode 100644 index 000000000..24f513b32 --- /dev/null +++ b/codes/guqi123/15821287.java @@ -0,0 +1,11 @@ +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; + } + } + } +} -- Gitee