Estructuras_de_Datos/src/cl/cromer/estructuras/code/burbuja/ordenar

13 lines
275 B
Plaintext

public void burbuja() {
for (int i = elementos - 1; i > 1; i--) {
for(j = 0; in < i; j++) {
// Si están fuera del orden
if (array[j] > array[j+1]) {
// Intercambiar valores
int temp = array[j];
array[j] = array[j+1];
array[j+1] = temp;
}
}
}
}