mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-19 00:37:02 +00:00
optimization (#1303)
This commit is contained in:
parent
f0568d642e
commit
e80d248e65
|
@ -35,7 +35,8 @@ def selection_sort(collection):
|
||||||
for k in range(i + 1, length):
|
for k in range(i + 1, length):
|
||||||
if collection[k] < collection[least]:
|
if collection[k] < collection[least]:
|
||||||
least = k
|
least = k
|
||||||
collection[least], collection[i] = (collection[i], collection[least])
|
if least != i:
|
||||||
|
collection[least], collection[i] = (collection[i], collection[least])
|
||||||
return collection
|
return collection
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user