Two ways of doing Counting Sort
问题 Here are my two implementations of Counting Sort In this implementation which is a very simple one, all I do is count the number of occurrences of the element, and insert as many times as the occurrences in the output array. Implementation 1 public class Simple { static int[] a = {5,6,6,4,4,4,8,8,8,9,4,4,3,3,4}; public static void main(String[] args) { fun(a); print(a); } static void fun(int[] a) { int max = findMax(a); int[] temp = new int[max+1]; for(int i = 0;i<a.length;i++) { temp[a[i]]++