Bubble sort · Ordenamiento burbuja
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.
Ordenamiento burbuja
Ordenar un array en orden ascendente in place (en el lugar) utilizando el algoritmo de ordenamiento burbuja: recorrer el array comparando cada par de elementos adyacentes e intercambiarlos si están en el orden incorrecto. Después de cada pasada completa, el valor más grande restante ha "burbujeado" hacia el final, por lo que se repite el proceso hasta que todo quede ordenado.
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. · Complete void bubble_sort(int *a, int n) para ordenar los n elementos en orden ascendente, in situ. Pase repetidamente por el array intercambiando cualquier par de vecinos desordenados.
Click Run to see the output here. · Haz clic en Ejecutar para ver la salida aquí.