I am trying to write a program for LSD (Least Significant Digit) Count sort in Java to sort strings of fixed length by count sort method applied at a particular position of string. It compiles fine but at run time, it gives java.lang.NoClassDefFoundError. I have tried searching net for it but have not received a solution so far. So, I would be very grateful if someone could point out my mistake. Thanks in advance!
public class LSD
{
public static void LSDsort(String[] a, int W) // fixed-length W strings
{
int R = 256;
int N = a.length;
String[] aux = new String[N];
for (int d = W-1; d >= 0; d--)
{
int[] count = new int[R+1];
for (int i = 0; i < N; i++)
count[a[i].charAt(d) + 1]++;
for (int r = 0; r < R; r++)
count[r+1] += count[r];
for (int i = 0; i < N; i++)
aux[count[a[i].charAt(d)]++] = a[i];
for (int i = 0; i < N; i++)
a[i] = aux[i];
}
}
public static void main (String[] args)
{
String[] arr = {"11AG3EP04", "11AG30022", "11CS10023", "11EC10015",
"12CS3EP01", "10BT3FP01", "14NA10004", "13MF10012"};
LSDsort(arr, 9);
for (String s: arr) System.out.println(s);
}
}