MCPcopy Create free account
hub / github.com/DasyDong/developer-roadmap / shell_sort

Function shell_sort

code/all_sort.py:35–44  ·  view source on GitHub ↗
(relist)

Source from the content-addressed store, hash-verified

33
34# 希尔
35def shell_sort(relist):
36 n = len(relist)
37 gap = int(n / 2) # 初始步长
38 while gap > 0:
39 for i in range(gap, n):
40 relist[:i] = insertSort(relist[:i])
41 print(relist)
42 gap = int(gap / 2) # 得到新的步长
43
44 return relist
45
46
47# 插入

Callers

nothing calls this directly

Calls 1

insertSortFunction · 0.85

Tested by

no test coverage detected