mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-15 01:40:49 +08:00
Update ShellSort.java
This commit is contained in:
@ -22,7 +22,7 @@ public class ShellSort implements SortAlgorithm {
|
|||||||
for (; gap > 0; gap /= 3) {
|
for (; gap > 0; gap /= 3) {
|
||||||
for (int i = gap; i < length; i++) {
|
for (int i = gap; i < length; i++) {
|
||||||
int j;
|
int j;
|
||||||
T temp = array[i];
|
T temp = array[i];
|
||||||
for (j = i; j >= gap && less(temp, array[j - gap]); j -= gap) {
|
for (j = i; j >= gap && less(temp, array[j - gap]); j -= gap) {
|
||||||
array[j] = array[j - gap];
|
array[j] = array[j - gap];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user