You are viewing a single comment's thread. Return to all comments →
public static List<Integer> countingSort(List<Integer> arr) { int[] frequency = new int[100]; for(int i = 0; i < arr.size(); i++) { frequency[arr.get(i)] = ++frequency[arr.get(i)]; } List<Integer> answer = Arrays.stream(frequency) .boxed() .collect(Collectors.toList()); return answer; }
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 →