mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-11-10 11:09:43 +08:00
Merge eb8ca90bb0
into ca3d16dcce
This commit is contained in:
commit
441e96ff1c
@ -21,9 +21,7 @@ export default class ShellSort extends Sort {
|
|||||||
|
|
||||||
// Compare and swap array elements if needed.
|
// Compare and swap array elements if needed.
|
||||||
if (this.comparator.lessThan(array[gapShiftedIndex], array[currentIndex])) {
|
if (this.comparator.lessThan(array[gapShiftedIndex], array[currentIndex])) {
|
||||||
const tmp = array[currentIndex];
|
[array[currentIndex], array[gapShiftedIndex]] = [array[gapShiftedIndex], array[currentIndex]];
|
||||||
array[currentIndex] = array[gapShiftedIndex];
|
|
||||||
array[gapShiftedIndex] = tmp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gapShiftedIndex = currentIndex;
|
gapShiftedIndex = currentIndex;
|
||||||
|
Loading…
Reference in New Issue
Block a user