Skip to content

Commit e026001

Browse files
committed
Improved Implementation presentation | Counting Sort
1 parent e6e6648 commit e026001

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

Sorts/CountingSort.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,14 @@ function countingSort (arr, min, max) {
3030
return arr
3131
}
3232

33-
const arr = [3, 0, 2, 5, 4, 1]
34-
35-
// Array before Sort
36-
console.log('-----before sorting-----')
37-
console.log(arr)
38-
// Array after sort
39-
console.log('-----after sorting-----')
40-
console.log(countingSort(arr, 0, 5))
33+
/**
34+
* Implementation of Counting Sort
35+
*/
36+
const array = [3, 0, 2, 5, 4, 1]
37+
// Before Sort
38+
console.log('\n- Before Sort | Implementation of Counting Sort -')
39+
console.log(array)
40+
// After Sort
41+
console.log('- After Sort | Implementation of Counting Sort -')
42+
console.log(comcountingSortbSort(array))
43+
console.log('\n')

0 commit comments

Comments
 (0)