MCPcopy Create free account
hub / github.com/catid/supercharger / bubbleSort

Method bubbleSort

airate/tests/bubble.java:3–18  ·  view source on GitHub ↗
(int[] arr)

Source from the content-addressed store, hash-verified

1public class MySorting {
2
3 public static void bubbleSort(int[] arr) {
4 boolean swapped = true;
5 int n = arr.length;
6 while (swapped) {
7 swapped = false;
8 for (int i = 1; i < n; i++) {
9 if (arr[i - 1] > arr[i]) {
10 int temp = arr[i - 1];
11 arr[i - 1] = arr[i];
12 arr[i] = temp;
13 swapped = true;
14 }
15 }
16 n--;
17 }
18 }
19}
20
21public class MySorting {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected