Skip to content

Instantly share code, notes, and snippets.

@Anthonymcqueen21
Last active February 2, 2023 01:23
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 Anthonymcqueen21/ef5ea7d486873d0512f82f12e14298bc to your computer and use it in GitHub Desktop.
Save Anthonymcqueen21/ef5ea7d486873d0512f82f12e14298bc to your computer and use it in GitHub Desktop.
# Selection Sorting
def selection_sort(arr):
for k in range(len(arr):
min_index = k # this is smallest element
for j in range(k+1, len(arr)):
if arr[min_index] > arr[j]:
min_index = j
arr[k], arr[min_index] = arr[min_index], arr[k]
@Anthonymcqueen21
Copy link
Author

Tester

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment