File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed
src/algorithms/sorting/counting-sort/__test__ Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -27,14 +27,10 @@ describe('CountingSort', () => {
2727 const sorter = new CountingSort ( { visitingCallback } ) ;
2828
2929 // Detect biggest number in array in prior.
30- const biggestElement = notSortedArr . reduce ( ( accumulator , element ) => {
31- return element > accumulator ? element : accumulator ;
32- } , 0 ) ;
30+ const biggestElement = Math . max ( ...notSortedArr ) ;
3331
3432 // Detect smallest number in array in prior.
35- const smallestElement = notSortedArr . reduce ( ( accumulator , element ) => {
36- return element < accumulator ? element : accumulator ;
37- } , 0 ) ;
33+ const smallestElement = Math . min ( ...notSortedArr ) ;
3834
3935 const sortedArray = sorter . sort ( notSortedArr , smallestElement , biggestElement ) ;
4036
You can’t perform that action at this time.
0 commit comments