mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-12-18 01:00:15 +00:00
Optimization shell sort (#4119)
* optimization * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
parent
71b1202d04
commit
67b33a295b
|
@ -26,6 +26,7 @@ def shell_sort(collection):
|
||||||
while j >= gap and collection[j - gap] > insert_value:
|
while j >= gap and collection[j - gap] > insert_value:
|
||||||
collection[j] = collection[j - gap]
|
collection[j] = collection[j - gap]
|
||||||
j -= gap
|
j -= gap
|
||||||
|
if j != i:
|
||||||
collection[j] = insert_value
|
collection[j] = insert_value
|
||||||
return collection
|
return collection
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user