@@ -116,7 +116,7 @@ private void bubbleSort() {
116116 // Add the pair of indexes that were swapped to the list.
117117 arrDisplay .addSwappedIndexes (j , j + 1 );
118118 // Repaint the new array.
119- publish (arr . clone () );
119+ publish ();
120120 sleep ();
121121 }
122122 }
@@ -126,7 +126,7 @@ private void bubbleSort() {
126126 if (!algVisualizer .stopSort ()) {
127127 algVisualizer .setEndTime (System .currentTimeMillis ());
128128 arrDisplay .setComplete (true );
129- publish (arr . clone () );
129+ publish ();
130130 sleep ();
131131 }
132132 }
@@ -154,13 +154,13 @@ private void selectionSort() {
154154 // Add a pair of swapped indexes
155155 arrDisplay .addSwappedIndexes (min_idx , i );
156156 // Repaint the new array.
157- publish (arr . clone () );
157+ publish ();
158158 sleep ();
159159 }
160160 // If sorting hasn't been stopped, set complete and draw one more time.
161161 if (!algVisualizer .stopSort ()) {
162162 arrDisplay .setComplete (true );
163- publish (arr . clone () );
163+ publish ();
164164 sleep ();
165165 }
166166 }
@@ -178,7 +178,7 @@ private void insertionSort() {
178178
179179 while (j >= 0 && arr [j ] > key ) { // compare arr[j] and arr[i]
180180 if (algVisualizer .stopSort ()) {
181- publish (arr . clone () );
181+ publish ();
182182 sleep ();
183183 break ;
184184 }
@@ -190,7 +190,7 @@ private void insertionSort() {
190190 // Add a pair of swapped indexes
191191 arrDisplay .addSwappedIndexes (j , j + 1 );
192192 // Repaint the array
193- publish (arr . clone () );
193+ publish ();
194194 sleep ();
195195 }
196196 // Add a pair of swapped indexes
@@ -201,7 +201,7 @@ private void insertionSort() {
201201 // If sorting hasn't been stopped, set complete and draw one more time.
202202 if (!algVisualizer .stopSort ()) {
203203 arrDisplay .setComplete (true );
204- publish (arr . clone () );
204+ publish ();
205205 sleep ();
206206 }
207207 }
@@ -222,7 +222,7 @@ private void mergeSort(int l, int r) {
222222 // If sorting is done and a reset has not been done, repaint one more time
223223 if (isSorted () && !algVisualizer .stopSort ()) {
224224 arrDisplay .setComplete (true );
225- publish (arr . clone () );
225+ publish ();
226226 sleep ();
227227
228228 }
@@ -268,15 +268,15 @@ private void merge(int l, int m, int r) {
268268 // Add a pair of swapped indexes
269269 arrDisplay .addSwappedIndexes (k , k + i );
270270 // Repaint the array
271- publish (arr . clone () );
271+ publish ();
272272 sleep ();
273273 } else {
274274 arr [k ] = R [j ];
275275 j ++;
276276 // Add a pair of swapped indexes
277277 arrDisplay .addSwappedIndexes (k , k + j );
278278 // Repaint the arrays
279- publish (arr . clone () );
279+ publish ();
280280 sleep ();
281281 }
282282 k ++;
@@ -292,7 +292,7 @@ private void merge(int l, int m, int r) {
292292 // Add a pair of swapped indexes
293293 arrDisplay .addSwappedIndexes (k , k + i );
294294 // Repaint the array
295- publish (arr . clone () );
295+ publish ();
296296 sleep ();
297297 i ++;
298298 k ++;
@@ -307,7 +307,7 @@ private void merge(int l, int m, int r) {
307307 arr [k ] = R [j ];
308308 // Add a pair of swapped indexes
309309 arrDisplay .addSwappedIndexes (k , k + j );
310- publish (arr . clone () );
310+ publish ();
311311 sleep ();
312312 j ++;
313313 k ++;
@@ -330,7 +330,7 @@ private void quickSort(int low, int high) {
330330 // the array is sorted besides this
331331 if (isSorted () && !algVisualizer .stopSort ()) {
332332 arrDisplay .setComplete (true );
333- publish (arr . clone () );
333+ publish ();
334334 sleep ();
335335 }
336336 }
0 commit comments