Created
July 13, 2020 13:42
-
-
Save chirag-shinde/cb4e3d8fd4527ace9f8eab825ad3a974 to your computer and use it in GitHub Desktop.
This file contains hidden or 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(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