diff --git a/Sorting Algorithms/BubbleSort.java b/Sorting Algorithms/BubbleSort.java new file mode 100644 index 0000000..c890c16 --- /dev/null +++ b/Sorting Algorithms/BubbleSort.java @@ -0,0 +1,33 @@ +public class BubbleSort { + public static void BubbleSort( int [ ] no ) + { + int j; + boolean flag = true; + int temp; + + while ( flag ) + { + flag= false; + for( j=0; j < no.length -1; j++ ) + { + if ( no[ j ] < no[j+1] ) + { + temp = no[ j ]; + no[ j ] = no[ j+1 ]; + no[ j+1 ] = temp; + flag = true; + } + } + } + + for(int p = 0 ;p