Created
May 28, 2018 19:26
-
-
Save camarin24/07b592ffe5bece8a2012d0b858637ac2 to your computer and use it in GitHub Desktop.
Ordenamiento por selección
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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