Skip to content

Instantly share code, notes, and snippets.

@chirag-shinde
Created July 13, 2020 13:42
Show Gist options
  • Save chirag-shinde/cb4e3d8fd4527ace9f8eab825ad3a974 to your computer and use it in GitHub Desktop.
Save chirag-shinde/cb4e3d8fd4527ace9f8eab825ad3a974 to your computer and use it in GitHub Desktop.
def selection_sort(arr):
for i in range(len(arr)):
min_element_index = i
for j in range(i + 1, len(arr)):
if arr[j] < arr[min_element_index]:
min_element_index = j
arr[i], arr[min_element_index] = arr[min_element_index], arr[i]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment