Skip to content

Commit 98cc298

Browse files
Optimised for loop iteration
1 parent 6a6349b commit 98cc298

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sorts/selection_sort.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def selection_sort(collection):
3131
"""
3232

3333
length = len(collection)
34-
for i in range(length):
34+
for i in range(length - 1):
3535
least = i
3636
for k in range(i + 1, length):
3737
if collection[k] < collection[least]:

0 commit comments

Comments
 (0)