Radix sort vs Counting sort vs Bucket sort. What's the difference?
I am reading the definitions of radix, counting and bucket sorts and it seems that all of them are just the code below: public static void sort(int[] a, int maxVal){ int [] bucket=new int[maxVal+1]; for (int i=0; i<bucket.length; i++){ bucket[i]=0; } for (int i=0; i<a.length; i++){ bucket[a[i]]++; } int outPos=0; for (int i=0; i<bucket.length; i++){ for (int j=0; j<bucket[i]; j++){ a[outPos++]=i; } } } I know I can't be right, so what am I missing? Show the code if you think that can help explaining in Java or C. Konstantin Vladimirov Let's start with some rewriting your code in C, because C