Skip to content

Commit

Permalink
Optimised for loop iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
YasirChoudhary committed Oct 7, 2018
1 parent 6a6349b commit 98cc298
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sorts/selection_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def selection_sort(collection):
"""

length = len(collection)
for i in range(length):
for i in range(length - 1):
least = i
for k in range(i + 1, length):
if collection[k] < collection[least]:
Expand Down

0 comments on commit 98cc298

Please sign in to comment.