mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 09:21:13 +08:00
optimization (#1303)
This commit is contained in:

committed by
Christian Clauss

parent
f0568d642e
commit
e80d248e65
@ -35,7 +35,8 @@ def selection_sort(collection):
|
||||
for k in range(i + 1, length):
|
||||
if collection[k] < collection[least]:
|
||||
least = k
|
||||
collection[least], collection[i] = (collection[i], collection[least])
|
||||
if least != i:
|
||||
collection[least], collection[i] = (collection[i], collection[least])
|
||||
return collection
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user