Skip to content

Commit 6b5cc0c

Browse files
committed
[Sorting and Searching Algorithms]
1 parent e6c7279 commit 6b5cc0c

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

examples/PacktDataStructuresAlgorithms.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/js/algorithms/sorting/bucket-sort.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ function sortBuckets(buckets) {
2525
for (let i = 0; i < buckets.length; i++) {
2626
if (buckets[i] != null) {
2727
insertionSort(buckets[i]);
28-
for (let j = 0; j < buckets[i].length; j++) {
29-
sortedArray.push(buckets[i][j]);
30-
}
28+
sortedArray.push(...buckets[i]);
3129
}
3230
}
3331
return sortedArray;

src/ts/algorithms/sorting/bucket-sort.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ function sortBuckets(buckets: number[][]) {
3030
if (buckets[i] != null) {
3131
insertionSort(buckets[i]);
3232

33-
for (let j = 0; j < buckets[i].length; j++) {
34-
sortedArray.push(buckets[i][j]);
35-
}
33+
sortedArray.push(...buckets[i]);
3634
}
3735
}
3836

0 commit comments

Comments
 (0)