This commit is contained in:
Nishi Agrawal 2024-07-17 10:40:02 +09:00 committed by GitHub
commit 441e96ff1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,9 +21,7 @@ export default class ShellSort extends Sort {
// Compare and swap array elements if needed.
if (this.comparator.lessThan(array[gapShiftedIndex], array[currentIndex])) {
const tmp = array[currentIndex];
array[currentIndex] = array[gapShiftedIndex];
array[gapShiftedIndex] = tmp;
[array[currentIndex], array[gapShiftedIndex]] = [array[gapShiftedIndex], array[currentIndex]];
}
gapShiftedIndex = currentIndex;