Counting Sort 1

  • + 0 comments

    In java:

            int frequency = 100;
            List<Integer> alternativeSortingList = new ArrayList<>(Collections.nCopies(100,0));
            for (Integer integer : arr) {
                alternativeSortingList.set(integer, alternativeSortingList.get(integer)+1 );
            }
            return alternativeSortingList;