Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created August 31, 2020 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/4f08b029482175b194fc62a05930cfb1 to your computer and use it in GitHub Desktop.
Save parzibyte/4f08b029482175b194fc62a05930cfb1 to your computer and use it in GitHub Desktop.
public static void ordenarPorSeleccion(int[] arreglo) {
for (int i = 0; i < arreglo.length - 1; i++) {
for (int j = i + 1; j < arreglo.length; j++) {
if (arreglo[i] > arreglo[j]) {
// ...intercambiarlos, es decir, mover el actual a la derecha y el de la derecha al actual
int temporal = arreglo[i];
arreglo[i] = arreglo[j];
arreglo[j] = temporal;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment