Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static long countingSort(int[] list) {
- int high = 999;
- int low = 0;
- int[] counts = new int[high - low + 1];
- for(int i = 0; i < counts.length; i++) {
- counts[i] = 0;
- }
- int x = 0;
- for(int i = low; i <= high; i++) {
- list[x] = i;
- x += 1;
- counts[i - low] = counts[i - low] - 1;
- }
- return list;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement