From 6b1af4cf0c27782e9c3e682309a52817dd45482c Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Tue, 17 Nov 2020 15:04:45 +0700 Subject: [PATCH] Implement Bubble Sort Instead of using Built-in method --- Assignement12/bin/HistogramDataDisplay.class | Bin 1607 -> 1733 bytes Assignement12/src/HistogramDataDisplay.java | 19 ++++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Assignement12/bin/HistogramDataDisplay.class b/Assignement12/bin/HistogramDataDisplay.class index 66578d350bbb3f423aab636e4e3472557f1409df..73a9c70f5444e10998e724ca4f5ee08ed99c49ce 100644 GIT binary patch delta 764 zcmZXR-%FEG7{@>7{jqn>&1^bN@kJv<*-$BDiLjZar8QeMe>BbV)h*GM$uIOjRf`JV6hdA>a7v-gwF^X1p!5im$<&+|$f zbQ4vmpoe}gc^PIvVXkLa*79zyC|sSn&Qwj%&8Px5*M#cvFwPB&>&14xNslp69MHR5 zaWA*HT}DHJr^l8wzc1T;X2HC90s*nU%dFTVNxfe!Q-*GEOc( z?PL_bMBZ6?G~ujII*XaK#gxSZMg6Mt)alDOYs-C!yjWbea1;%5u@gMLxLRyA(x!n6 zv$$nk@MvvV;v7B}-y7WpJyIfUMD%Ehu8`duvWfT#iY9J8Gg_6o(p1 FzX2Tsgwg;2 delta 619 zcmZ9I%TAL~5XXP#yPfjU0+!ZGLgT^^YcVt-SPiCVy`U(lSZuBJ_Cae?X^^y^7+1JJ zd4RqEuDWr9i-wrkoiXuc^a-d_V@WjUWMLf?b#kAp8AV1~+``^l)f%yLZ3O`q1?sxoWl3|d`O7$J-Y44}Fi$%Vg5=0IQ|3ax5ac|giou>ux%9_c zVH8D9*SviFrl?uzZ(j4(E6J=c%TzR_=1=pD?ckuB zYu1#j-lOHfPP1jjwM*gs--_-Xh*BZ`xlu zSun?pT>{}-E$r|@wqV8fxsz?PoR6iqEfuw*_Q!5V;B6l6iI0gZaf+bCK~71I6XGmG zOftMBKRd!4M_6JMp9q@_^NwSD;JCmcfhBQAXd%gQp7DqxO2`Es^8`Z_&hb<#Q)aM@ z)8!&sqcqRuvw8`-L=SuFuov sortedArray[i + 1]) { + int temp = sortedArray[i]; + sortedArray[i] = sortedArray[i + 1]; + sortedArray[i + 1] = temp; + isSorted = false; + } + } + } int lastVal = -1; for (int i : sortedArray) { if (i == lastVal) System.out.print("*"); else { - System.out.format("%s%d\t*",(lastVal==-1)?"":"\n", i); - lastVal=i; + System.out.format("%s%d\t*", (lastVal == -1) ? "" : "\n", i); + lastVal = i; } } System.out.println();