mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-06 02:13:15 +08:00
Optimised for loop iteration
This commit is contained in:
@ -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]:
|
||||
|
Reference in New Issue
Block a user