Skip to content

Instantly share code, notes, and snippets.

@syedjafer
Created August 28, 2022 12:56
Show Gist options
  • Save syedjafer/cf993d0613e3d0b182972077ad98e0c0 to your computer and use it in GitHub Desktop.
Save syedjafer/cf993d0613e3d0b182972077ad98e0c0 to your computer and use it in GitHub Desktop.
def selection_sort(array, size):
for itr in range(size):
min_index = itr
for ctr in range(itr + 1, size):
if array[ctr] < array[min_index]:
min_index = ctr
array[itr], array[min_index] = array[min_index], array[itr]
arr = [29,10,14,37,14]
size = len(arr)
selection_sort(arr, size)
print(arr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment