diff --git a/Sorting/BubbleSort.java b/Sorting/BubbleSort.java new file mode 100644 index 00000000..7aaa79aa --- /dev/null +++ b/Sorting/BubbleSort.java @@ -0,0 +1,21 @@ +class BubbleSort{ + + static void BubbleSort(int arr[]){ + int n = arr.length; + + for(int i=0;iarr[j+1]){ + int temp=arr[j]; + arr[j]=arr[j+1]; + arr[j+1]=temp; + cnt++; + } + } + if(cnt==0){ + break; + } + } + } +}