From 482a7f8f17ba80cd54169068a382438743beee44 Mon Sep 17 00:00:00 2001 From: Skullheadx <704277@pdsb.net> Date: Tue, 24 Jan 2023 19:00:47 -0500 Subject: [PATCH] Update selection_sort.py --- sorting_algorithms/selection_sort.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorting_algorithms/selection_sort.py b/sorting_algorithms/selection_sort.py index cff5ee3..99d7f54 100644 --- a/sorting_algorithms/selection_sort.py +++ b/sorting_algorithms/selection_sort.py @@ -3,7 +3,7 @@ from utils import swap def selection_sort(array): - for index1 in range(len(array) - 1, -1, -1): # loop through from end + for index1 in range(len(array) - 1, 0, -1): # loop through from end swap_index = 0 # largest element to swap with for index2 in range(index1 + 1): # loop through the first index1 elements if array[index2] > array[swap_index]: # find the max element to swap with -- 2.54.0