Skip to content

Commit 6ca8366

Browse files
committed
indent
1 parent 38925de commit 6ca8366

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

include/shell_sort.h

+16-16
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ namespace alg {
2222
*/
2323
template<typename T>
2424
static void shell_sort(T *array, int len) {
25-
int h = 1;
26-
while (h < len / 3) {
27-
h = 3 * h + 1; // 1, 4, 13, 40, 121, ...
28-
}
29-
while (h >= 1) {
30-
for (int i = h; i < len; i++) {
31-
int cur = array[i];
32-
int j = i - h;
33-
while (j >= 0 && array[j] > cur) {
34-
array[j + h] = array[j];
35-
j = j - h;
36-
}
37-
array[j + h] = cur;
38-
}
39-
h = h / 3;
40-
}
25+
int h = 1;
26+
while (h < len / 3) {
27+
h = 3 * h + 1; // 1, 4, 13, 40, 121, ...
28+
}
29+
while (h >= 1) {
30+
for (int i = h; i < len; i++) {
31+
int cur = array[i];
32+
int j = i - h;
33+
while (j >= 0 && array[j] > cur) {
34+
array[j + h] = array[j];
35+
j = j - h;
36+
}
37+
array[j + h] = cur;
38+
}
39+
h = h / 3;
40+
}
4141
}
4242
}
4343

0 commit comments

Comments
 (0)