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 94dc08a commit ddae517Copy full SHA for ddae517
algorithm/sort/shell_sort.md
@@ -107,7 +107,7 @@ func ShellSort(list []int) {
107
if deal < list[j] {
108
// 一直往左边找,比待排序大的数都往后挪,腾空位给待排序插入
109
for ; j >= 0 && deal < list[j]; j -= step {
110
- list[j+1] = list[j] // 某数后移,给待排序留空位
+ list[j+step] = list[j] // 某数后移,给待排序留空位(注意移动是以step为步长)
111
}
112
list[j+step] = deal // 结束了,待排序的数插入空位
113
code/sort/shell.go
@@ -21,7 +21,7 @@ func ShellSort(list []int) {
21
22
23
24
25
26
27
0 commit comments