From 6232f8dd42f2d5f001f7715c0e1f1a24ce9dbc32 Mon Sep 17 00:00:00 2001 From: Mandy8055 Date: Sun, 8 Aug 2021 17:14:41 +0530 Subject: [PATCH] Updated the count sort algorithm with stable implementation. Added ES6 syntactic sugar to the syntax --- Sorts/CountingSort.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Sorts/CountingSort.js b/Sorts/CountingSort.js index cc2dd18e5..86389b720 100644 --- a/Sorts/CountingSort.js +++ b/Sorts/CountingSort.js @@ -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 } /**