From 513816220ad194221d0c71f469d848be1b5719e2 Mon Sep 17 00:00:00 2001 From: Bruno Lima Date: Sat, 8 May 2021 18:58:58 -0300 Subject: [PATCH 1/2] some enhancement in BubbleSort Algorithm --- .DS_Store | Bin 0 -> 6148 bytes .idea/misc.xml | 2 +- .../sorting/bubble_sort/BubbleSort.java | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..119031ed874d9ff5556979ffba1eaa2f246559f8 GIT binary patch literal 6148 zcmeHK(TdYR6ur}CHI0aU5EMZOf^W67Rj57)-P(QF2SJSJgUW8wgf@_7mNd0!t@Pbb z(0}kl`~bhjCp~v&Dm1%3Dz40hJ7;F@J##asB-0@xFNbB1x8{glE5PrrLv5N+N@eB!-AAnbLz&uyx6MQDgmRKpP*UN1 zsc`ndNhzj;!re@9vyyp>Mif#B_bC7tw4gC?!BuFE*$_2j;67!j&(-nFG^H7$TxCXC zrN+lfjRrlX1Mo-m7}y3Qt}wn=7D42zdMdJ>k?$n>8{nf>aA(epG}9yPB%l6e`Xc~U5H8Yf73 z^&-t&~#y1fVYT7Iv;ZuzTjr+>HQ_wV=C>xO&ncK6}o z@$Bup)%*2_PuL7h2#s{b;1)ikV`O*}6nQ3d-u^awn`QCbDPVp=_tLq0a{Itm0jt2D zR)D_`KAdr2aHCOuI?$*q0MNm-GW6A7f1uA3z=6SyM$Ev3rUErpm@9@bHwU5Vh!0Hu zMx&;aP?fQcsVvM5MVO0+@KrjAfkxX}1*`(Q3e@$m$>;yU@9+P+Bs;PSSOxwo1%xvS zMni1LoUNxe$7ih%KZdh$-bSOMpfSg>>hMu~9j**9pF6;T!Hq`D!0aCZC4+6O0)JJ3 EpJo!G*#H0l literal 0 HcmV?d00001 diff --git a/.idea/misc.xml b/.idea/misc.xml index 0548357..e0844bc 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/algorithms/sorting/bubble_sort/BubbleSort.java b/src/algorithms/sorting/bubble_sort/BubbleSort.java index d6fc4fc..b3e6602 100644 --- a/src/algorithms/sorting/bubble_sort/BubbleSort.java +++ b/src/algorithms/sorting/bubble_sort/BubbleSort.java @@ -4,7 +4,7 @@ public class BubbleSort { public int[] bubbleSort(int[] array) { - for (int i = 0; i < array.length; i++) { + for (int i = 0; i < array.length - 1; i++) { for (int j = 0; j < array.length-1; j++) { if (array[j] > array[j + 1]) { int temp = array[j]; From ecaa1e448339be7d91d962f53d2c6946cb95669b Mon Sep 17 00:00:00 2001 From: Bruno Lima Date: Sat, 8 May 2021 19:03:53 -0300 Subject: [PATCH 2/2] Update misc.xml --- .idea/misc.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index e0844bc..6449aab 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + - \ No newline at end of file +