Specification
RadixSort.java contains a couple of defects that need to be fixed. These defects are listed in the
"caveats" section of the program's file comment block.
Note: class RadixSort extends Object and this cannot be changed.
Part 0
Modify the program so that the elements of array a are in following domain:
Integer.MIN_VALUE ≤ a[i] ≤ Integer.MAX_VALUE
where 0 ≤ i < a.length
Part 1
Modify the program so that the "buckets" are not array length sized array-of-ints (i.e. space hogs).
Each bucket, when used, becomes a singly-linked-list of class IntNode objects.
class IntNode {
int n;
IntNode next;
}
Note: The "buckets" 2-dimensional array switches from type int to type IntNode and null is used as
EMPTY_SLOT.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
23 | 24 | 25 | 26 | 27 | 28 | 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 1 | 2 | 3 | 4 | 5 |
Get Free Quote!
343 Experts Online