2016-06-20 13:25:01 -04:00
|
|
|
public void burbuja() {
|
2016-07-03 11:28:26 -04:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-06-20 13:25:01 -04:00
|
|
|
}
|