From e0260015cb9e690bb06c8d55a19fd37e24bc1ffb Mon Sep 17 00:00:00 2001 From: marsonya Date: Sun, 24 Jan 2021 23:34:22 +0530 Subject: [PATCH] Improved Implementation presentation | Counting Sort --- Sorts/CountingSort.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Sorts/CountingSort.js b/Sorts/CountingSort.js index 3c628d3e9..b4f84eb6c 100644 --- a/Sorts/CountingSort.js +++ b/Sorts/CountingSort.js @@ -30,11 +30,14 @@ function countingSort (arr, min, max) { return arr } -const arr = [3, 0, 2, 5, 4, 1] - -// Array before Sort -console.log('-----before sorting-----') -console.log(arr) -// Array after sort -console.log('-----after sorting-----') -console.log(countingSort(arr, 0, 5)) +/** +* Implementation of Counting Sort +*/ +const array = [3, 0, 2, 5, 4, 1] +// Before Sort +console.log('\n- Before Sort | Implementation of Counting Sort -') +console.log(array) +// After Sort +console.log('- After Sort | Implementation of Counting Sort -') +console.log(comcountingSortbSort(array)) +console.log('\n')