MCPcopy Create free account
hub / github.com/apna-college/Alpha / bubbleSort

Method bubbleSort

2_Basic Sorting/BubbleSort.java:6–17  ·  view source on GitHub ↗
(int arr[])

Source from the content-addressed store, hash-verified

4
5public class BubbleSort {
6 public static void bubbleSort(int arr[]) {
7 for(int turn=0; turn<arr.length-1; turn++) {
8 for(int j=0; j<arr.length-1-turn; j++) {
9 if(arr[j] > arr[j+1]) {
10 //swap
11 int temp = arr[j];
12 arr[j] = arr[j+1];
13 arr[j+1] = temp;
14 }
15 }
16 }
17 }
18
19 public static void modifiedBubbleSort(int arr[]) {
20 for(int turn=0; turn<arr.length-1; turn++) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected