From e1f73ef81bdeb7fba5b81ed3f0c47aaccc773711 Mon Sep 17 00:00:00 2001 From: forz4ever <2542642379@qq.com> Date: Sun, 6 Oct 2024 13:40:46 +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/forz4ever/18245446.java | 12 ++++++++++++ codes/forz4ever/:wq | 12 ++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 codes/forz4ever/18245446.java create mode 100644 codes/forz4ever/:wq diff --git a/codes/forz4ever/18245446.java b/codes/forz4ever/18245446.java new file mode 100644 index 00000000..40ff0be2 --- /dev/null +++ b/codes/forz4ever/18245446.java @@ -0,0 +1,12 @@ +/** + * 冒泡函数排序 + * aa bb cc + * @param a 待排序的数组 + * @param n 待排序的数组长度 + */ +public static void bubbleSort(int [] a, int n){ + //你的代码,,使无序数组 a 变得有序 + + + +}//end diff --git a/codes/forz4ever/:wq b/codes/forz4ever/:wq new file mode 100644 index 00000000..40ff0be2 --- /dev/null +++ b/codes/forz4ever/:wq @@ -0,0 +1,12 @@ +/** + * 冒泡函数排序 + * aa bb cc + * @param a 待排序的数组 + * @param n 待排序的数组长度 + */ +public static void bubbleSort(int [] a, int n){ + //你的代码,,使无序数组 a 变得有序 + + + +}//end -- Gitee From 34ac72dd1e4c5aaa149e96a99d160081b4cc637d Mon Sep 17 00:00:00 2001 From: forz4ever <2542642379@qq.com> Date: Sun, 6 Oct 2024 14:01:56 +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/forz4ever/18245446.java | 11 ++++++++++- codes/forz4ever/:wq | 12 ------------ 2 files changed, 10 insertions(+), 13 deletions(-) delete mode 100644 codes/forz4ever/:wq diff --git a/codes/forz4ever/18245446.java b/codes/forz4ever/18245446.java index 40ff0be2..658ad63a 100644 --- a/codes/forz4ever/18245446.java +++ b/codes/forz4ever/18245446.java @@ -6,7 +6,16 @@ */ public static void bubbleSort(int [] a, int n){ //你的代码,,使无序数组 a 变得有序 + for(iint 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 diff --git a/codes/forz4ever/:wq b/codes/forz4ever/:wq deleted file mode 100644 index 40ff0be2..00000000 --- a/codes/forz4ever/:wq +++ /dev/null @@ -1,12 +0,0 @@ -/** - * 冒泡函数排序 - * aa bb cc - * @param a 待排序的数组 - * @param n 待排序的数组长度 - */ -public static void bubbleSort(int [] a, int n){ - //你的代码,,使无序数组 a 变得有序 - - - -}//end -- Gitee From 7283e6360bdf199beffc2f5fa9d703055c667016 Mon Sep 17 00:00:00 2001 From: forz4ever <2542642379@qq.com> Date: Sun, 6 Oct 2024 14:03:52 +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/forz4ever/18245446.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codes/forz4ever/18245446.java b/codes/forz4ever/18245446.java index 658ad63a..c6572040 100644 --- a/codes/forz4ever/18245446.java +++ b/codes/forz4ever/18245446.java @@ -6,7 +6,7 @@ */ public static void bubbleSort(int [] a, int n){ //你的代码,,使无序数组 a 变得有序 - for(iint i = 0;i < n - 1;i++){ + 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]; -- Gitee