Optimised for loop iteration

This commit is contained in:
YasirChoudhary 2018-10-07 14:33:56 +05:30
parent 6a6349bdb0
commit 98cc298e61

View File

@ -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]: