Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

bubble sort in c

//bubble sort in C
//a is an array and q is its length
for(int i = 0; i<q; i++){
            for(int j = 0; j<q-1; j++){
                if(a[j]>a[j+1]){
                    a[j] ^= a[j+1];
                    a[j+1] ^= a[j];
                    a[j] ^= a[j+1];
                }
            }
        }
 
PREVIOUS NEXT
Tagged: #bubble #sort
ADD COMMENT
Topic
Name
1+4 =