Skip to content

Commit 3b856be

Browse files
authored
Merge pull request #1206 from harshita-2003/main
Beautified the code
2 parents 23abe2c + 02e87f9 commit 3b856be

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

sorting/bubble_sort.class

745 Bytes
Binary file not shown.

sorting/bubble_sort.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ Bubble sort is O(n) on a list that is already sorted i.e. Best case
2020
Output : [0 1 2 3 4 5 9]
2121
*/
2222

23-
public class BubbleSort {
23+
import java.util.Arrays;
24+
25+
public class bubble_sort {
2426
public static void bubbleSort(int[] arr) {
2527
int n = arr.length;
2628
// Traverse through all array elements
@@ -40,9 +42,6 @@ public static void bubbleSort(int[] arr) {
4042
public static void main(String[] args) {
4143
int[] arr = {64, 34, 25, 12, 22, 11, 90};
4244
bubbleSort(arr);
43-
System.out.println("Sorted array: ");
44-
for (int i = 0; i < arr.length; i++) {
45-
System.out.print(arr[i] + " ");
46-
}
45+
System.out.println(Arrays.toString(arr));
4746
}
4847
}

0 commit comments

Comments
 (0)