mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 17:34:49 +08: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:
@ -26,7 +26,8 @@ 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
|
||||||
collection[j] = insert_value
|
if j != i:
|
||||||
|
collection[j] = insert_value
|
||||||
return collection
|
return collection
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user