Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9e50768

Browse files
authored
Update shell_sort.py
1 parent f4f1f7a commit 9e50768

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

algorithm/sort/shell_sort.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
def shell_sort(arr):
66
n = len(arr)
77
# 初始步长
8-
gap = round(n / 2)
8+
gap = n // 2
99
while gap > 0:
1010
for i in range(gap, n):
1111
# 每个步长进行插入排序
@@ -17,5 +17,5 @@ def shell_sort(arr):
1717
j -= gap
1818
arr[j] = temp
1919
# 得到新的步长
20-
gap = round(gap / 2)
21-
return arr
20+
gap = gap // 2
21+
return arr

0 commit comments

Comments
 (0)