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

13 lines
270 B
Plaintext

public void seleccion() {
for (int i = 0; i < elementos - 1; i++) {
int minimo = i;
for (int j = i + 1; j < elementos; j++) {
if (array[j] < array[minimo]) {
minimo = j;
}
}
int temp = array[i];
array[i] = array[minimo];
array[minimo] = temp;
}
}