We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bf9e301 commit c527f83Copy full SHA for c527f83
4.shellSort.md
@@ -63,6 +63,30 @@ def shellSort(arr):
63
}
64
```
65
66
+不太明白作者一下代码的含义,
67
+```python
68
+while(gap < len(arr)/3):
69
+ gap = gap*3+1
70
+```
71
+按照大部分博客说每次都除以2,以下代码也是可行的
72
73
+def shellSort(arr):
74
+ import math
75
+ gap=len(arr)/2
76
+
77
+ while gap > 0:
78
+ for i in range(gap,len(arr)):
79
+ temp = arr[i]
80
+ j = i-gap
81
+ while j >=0 and arr[j] > temp:
82
+ arr[j+gap]=arr[j]
83
+ j-=gap
84
+ arr[j+gap] = temp
85
+ gap = gap/2
86
+ return arr
87
88
89
90
## 4. Go 代码实现
91
92
```go
0 commit comments