mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 01:18:23 +08:00
Updated the count sort algorithm with stable implementation. Added ES6 syntactic sugar to the syntax
This commit is contained in:
@ -28,9 +28,7 @@ const countingSort = (arr, min, max) => {
|
||||
res[count[arr[i] - min]] = arr[i]
|
||||
count[arr[i] - min]--
|
||||
}
|
||||
// Copy the result back to back to original array
|
||||
arr = [...res]
|
||||
return arr
|
||||
return res
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user