Skip to content

Instantly share code, notes, and snippets.

@camarin24
Created May 28, 2018 19:26
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 camarin24/07b592ffe5bece8a2012d0b858637ac2 to your computer and use it in GitHub Desktop.
Save camarin24/07b592ffe5bece8a2012d0b858637ac2 to your computer and use it in GitHub Desktop.
Ordenamiento por selección
const OrdenPorSeleccion = m => {
for (let i = 0; i < m.length - 1; i++) {
let min = i;
for (let j = i + 1; j < m.length; j++) {
if (m[j] < m[min]) {
min = j;
}
}
const aux = m[i];
m[i] = m[min];
m[min] = aux;
}
return m;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment