Skip to content

Commit b831317

Browse files
authored
Add files via upload
2025/7/18 Selection_Sort
1 parent ec0e59b commit b831317

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sorting/Selection_Sort.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ def selection_sort(arr:list[int])->list[int]:
77
min_index = j #update the index of the minimum element
88
arr[i], arr[min_index] = arr[min_index], arr[i] #swap the found minimum element return arr
99
return arr
10+
#main function to test the selection_sort function
1011
if __name__ == "__main__":
1112
arr = [64, 25, 12, 22, 11]
1213
print(f"Original array:{arr}")
1314
selection_sort(arr)
14-
print(f"Sorted array:{arr}")
15+
print(f"Sorted array(selection_sort):{arr}")

0 commit comments

Comments
 (0)