You are viewing a single comment's thread. Return to all comments →
** The Collections.nCopies(100, 0) creates a list with 100 elements, all initialized to 0 **
List count = new ArrayList<>(Collections.nCopies(100, 0)); for (int num : arr) { count.set(num, count.get(num) + 1); } return count; }
Seems like cookies are disabled on this browser, please enable them to open this website
Counting Sort 1
You are viewing a single comment's thread. Return to all comments →
List count = new ArrayList<>(Collections.nCopies(100, 0)); for (int num : arr) { count.set(num, count.get(num) + 1); } return count; }