You are viewing a single comment's thread. Return to all comments →
List<Integer> arr1 = new ArrayList<Integer>(arr); System.out.println(arr); System.out.println(arr.size()); int point = 0; while (point < arr.size() ) { for (int i = 0; i < arr.size(); i++) { if (point == i) { continue; } else { if (arr.get(point) == arr.get(i)) { arr.remove(i); } } } point++; } System.out.println(arr); int [] myArray = new int[Collections.max(arr) + 1]; for (int n : myArray) { n = 0; } int count; for (int i = 0; i < arr.size(); i++) { count = 0; for (int n : arr1) { if (arr.get(i) == n) { count++; } } System.out.println(arr.get(i) + " : " + count); myArray[arr.get(i)] = count; } System.out.println(Arrays.toString(myArray)); List list = Arrays.asList(myArray); System.out.println(list);
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 →