diff --git a/sort/BubbleSort.java b/sort/BubbleSort.java new file mode 100644 index 0000000..31013b3 --- /dev/null +++ b/sort/BubbleSort.java @@ -0,0 +1,14 @@ +public class BubbleSort{ + public int[] BubbleSort(int[] data){ + for (int i = 0; i < data.length -1; i++){ + for(int j = 0 ;j < data.length - i - 1; j++){ + if(data[j] < data[j + 1]){ + int temp = data[j]; + data[j] = data[j + 1]; + data[j + 1] = temp; + } + } + } + return data; + } +} \ No newline at end of file