Skip to content

Instantly share code, notes, and snippets.

@DiegoGallegos4
Last active April 12, 2019 02:34
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 DiegoGallegos4/d93be101c4a95d5a9b72dcf07926a646 to your computer and use it in GitHub Desktop.
Save DiegoGallegos4/d93be101c4a95d5a9b72dcf07926a646 to your computer and use it in GitHub Desktop.
Selection sort
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