Bubble sort · Tri à bulles
Bubble sort
Sort an array into ascending order in place using bubble sort: walk through the array comparing each pair of neighbours and swapping them if they're in the wrong order. After each full pass the largest remaining value has "bubbled" to the end, so repeat until everything is sorted.
Tri bulle
Triez un tableau par ordre croissant in situ en utilisant le tri bulle : parcourez le tableau en comparant chaque paire de voisins et en les échangeant s'ils sont dans le mauvais ordre. Après chaque passage complet, la plus grande valeur restante a « remonté » à la fin, donc répétez jusqu'à ce que tout soit trié.
Complete void bubble_sort(int *a, int n) to sort the n elements into ascending order, in place. Repeatedly pass through the array swapping any out-of-order neighbours. · Complétez void bubble_sort(int *a, int n) pour trier les n éléments en ordre croissant, in place. Passez répétitivement à travers le tableau en échangeant les voisins désordonnés.
Click Run to see the output here. · Cliquez sur Exécuter pour voir le résultat ici.