mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 16:26:47 +08:00
Improved Implementation presentation | Counting Sort
This commit is contained in:
@ -30,11 +30,14 @@ function countingSort (arr, min, max) {
|
|||||||
return arr
|
return arr
|
||||||
}
|
}
|
||||||
|
|
||||||
const arr = [3, 0, 2, 5, 4, 1]
|
/**
|
||||||
|
* Implementation of Counting Sort
|
||||||
// Array before Sort
|
*/
|
||||||
console.log('-----before sorting-----')
|
const array = [3, 0, 2, 5, 4, 1]
|
||||||
console.log(arr)
|
// Before Sort
|
||||||
// Array after sort
|
console.log('\n- Before Sort | Implementation of Counting Sort -')
|
||||||
console.log('-----after sorting-----')
|
console.log(array)
|
||||||
console.log(countingSort(arr, 0, 5))
|
// After Sort
|
||||||
|
console.log('- After Sort | Implementation of Counting Sort -')
|
||||||
|
console.log(comcountingSortbSort(array))
|
||||||
|
console.log('\n')
|
||||||
|
Reference in New Issue
Block a user