optimization (#1303)

This commit is contained in:
Du YuanChao 2019-10-08 16:25:00 +08:00 committed by Christian Clauss
parent f0568d642e
commit e80d248e65

View File

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