Bubble sort in C

Simple bubble sort in C –

for (i=0; i<n-1; i++){
    for(j=i+1; j<n; j++){
      if(x[j] < x[i]){           
           temp = x[j];
           x[j] = x[i];
           x[i] = temp;
      }
     }
}

Add a Comment

Your email address will not be published. Required fields are marked *