Bubble Sort Algorithm in C
/* Sorts list using bubble sort. Adjacent elements are compared and exchanged until list is completely ordered. */ void bubbleSort(int list[], int n) { int cur, j, temp; for (cur = 0; cur <= n; cur++){ for ( j = n; j > cur; j--) if(list[j ] < list[ j - 1]){ temp = list[ j ]; list[ j ] = list[ j – 1]; list[ j -1] = temp; } } return; }