diff --git a/src/iterative_sorting/iterative_sorting.py b/src/iterative_sorting/iterative_sorting.py index e27496b3..c3127bfb 100644 --- a/src/iterative_sorting/iterative_sorting.py +++ b/src/iterative_sorting/iterative_sorting.py @@ -6,21 +6,29 @@ def selection_sort( arr ): smallest_index = cur_index # TO-DO: find next smallest element # (hint, can do in 3 loc) - - - - + for j in range (cur_index+1,len(arr)): + #compare all values to value of curr index + # find the smallest + if arr[j]arr[j]: + arr[i],arr[j]=arr[j],arr[i] + made_a_swap=True + return arr