mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-03-27 17:06:44 +00:00
Optimised for loop iteration
This commit is contained in:
parent
6a6349bdb0
commit
98cc298e61
@ -31,7 +31,7 @@ def selection_sort(collection):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
length = len(collection)
|
length = len(collection)
|
||||||
for i in range(length):
|
for i in range(length - 1):
|
||||||
least = i
|
least = i
|
||||||
for k in range(i + 1, length):
|
for k in range(i + 1, length):
|
||||||
if collection[k] < collection[least]:
|
if collection[k] < collection[least]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user