Upgrade packages.

This commit is contained in:
Oleksii Trekhleb
2018-07-05 16:30:00 +03:00
parent 58640ee7b5
commit 17ad4dc4d1
14 changed files with 1695 additions and 542 deletions

View File

@@ -14,8 +14,8 @@ export default class InsertionSort extends Sort {
// Go and check if previous elements and greater then current one.
// If this is the case then swap that elements.
while (
array[currentIndex - 1] !== undefined &&
this.comparator.lessThan(array[currentIndex], array[currentIndex - 1])
array[currentIndex - 1] !== undefined
&& this.comparator.lessThan(array[currentIndex], array[currentIndex - 1])
) {
// Call visiting callback.
this.callbacks.visitingCallback(array[currentIndex - 1]);

View File

@@ -18,9 +18,9 @@ export default class RadixSort extends Sort {
const numPasses = this.determineNumPasses(sortedArray);
for (let currentIndex = 0; currentIndex < numPasses; currentIndex += 1) {
const buckets = isArrayOfNumbers ?
this.placeElementsInNumberBuckets(sortedArray, currentIndex) :
this.placeElementsInCharacterBuckets(sortedArray, currentIndex, numPasses);
const buckets = isArrayOfNumbers
? this.placeElementsInNumberBuckets(sortedArray, currentIndex)
: this.placeElementsInCharacterBuckets(sortedArray, currentIndex, numPasses);
// Flatten buckets into sortedArray, and repeat at next index
sortedArray = buckets.reduce((acc, val) => {