Question : buble sort c
Answered by : eagle
void bubbleSort(int arr[], int n){ int i, j; for (i = 0; i < n-1; i++) for (j = 0; j < n-i-1; j++) if (arr[j] > arr[j+1]) swap(&arr[j], &arr[j+1]);
}
Source : | Last Update : Wed, 31 Mar 21
Question : bubble sort c
Answered by : matheus-lins
int count; int aux; int array[count];
for (int i = 0; i < count; i++)
{ for (int j = 0; j < count - 1; j++) { if (array[j] > array[j + 1]) { aux = array[j]; array[j] = array[j+1]; array[j+1] = aux; } }
}
Source : | Last Update : Tue, 21 Jun 22