Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

nbubble sort java

   static void bubbleSort(int []arr){

        for(int i=0;i<arr.length-1;i++){
            for(int j=1;j< arr.length-i;j++){
                //swapping
                if(arr[j]<arr[j-1]){
                    int temp=arr[j];
                    arr[j]=arr[j-1];
                    arr[j-1]=temp;
                }
            }
        }
    }
 
PREVIOUS NEXT
Tagged: #nbubble #sort #java
ADD COMMENT
Topic
Name
3+6 =