MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / bubbleSort

Method bubbleSort

Java/Array/BubbleSort.java:55–66  ·  view source on GitHub ↗
(int [] arr)

Source from the content-addressed store, hash-verified

53 }
54
55 public static void bubbleSort(int [] arr) {
56 int n = arr.length;
57 for (int i = 0; i < n - 1- i; i++) {
58 for (int j = 0; j < n - 1; j++) {
59 if ( arr[j] > arr[j + 1]) {
60 int temp = arr[j];
61 arr[j] = arr[j + 1];
62 arr[j + 1] = temp;
63 }
64 }
65 }
66 }
67
68 public static int[] takeInput() {
69 Scanner sc = new Scanner(System.in);

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected