Skip to content

Commit 6232f8d

Browse files
committed
Updated the count sort algorithm with stable implementation. Added ES6 syntactic sugar to the syntax
1 parent c55ca93 commit 6232f8d

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Sorts/CountingSort.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ const countingSort = (arr, min, max) => {
2828
res[count[arr[i] - min]] = arr[i]
2929
count[arr[i] - min]--
3030
}
31-
// Copy the result back to back to original array
32-
arr = [...res]
33-
return arr
31+
return res
3432
}
3533

3634
/**

0 commit comments

Comments
 (0)