Last active
April 12, 2019 02:34
-
-
Save DiegoGallegos4/d93be101c4a95d5a9b72dcf07926a646 to your computer and use it in GitHub Desktop.
Selection sort
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
def selection_sort(A): | |
for i in range(len(A)): | |
min_index = i | |
for j in range(i+1, len(A)): | |
if A[j] < A[min_index]: | |
min_index = j | |
A[i], A[min_index] = A[min_index], A[i] | |
return A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment