💩

programierds

algoritmos / ordenamiento

Ordenamiento Burbuja
Paso a Paso

Visualizá cómo los elementos 'burbujean' hasta su posición correcta. Usá los controles para seguir la lógica línea por línea.

Implementación en C Line: -
1int arr[] = {5, 1, 4, 2, 8};
2int n = 5;
3for (int i = 0; i < n - 1; i++) {
4  for (int j = 0; j < n - i - 1; j++) {
5    if (arr[j] > arr[j + 1]) {
6      int temp = arr[j];
7      arr[j] = arr[j + 1];
8      arr[j + 1] = temp;
9    }
10  }
11}
i -
j -
Visualización del Arreglo
Hacé clic en "Comenzar" para iniciar la animación.
Paso 0 / 0
← Volver a todas las presentaciones