Assignment: #Sorting |
Due: 04/22/2018 |
Points: 5 |

Sorting.java is the codebase for this two part programming assignment. The program consists of two primary methods:

`and`

counting_sort()`.`

radix_sort()Note: These two sort algorithms are covered during lecture.

## counting_sort()

Implement the given

`method such that it sorts an array of type`

counting_sort()bytewhere the elements are in the [Byte.MIN_VALUE,Byte.MAX_VALUE] interval.Important note: The sort must be an implementation of a Counting Sort algorithm.

## radix_sort()

Make the following two modifications to the given

`method.`

radix_count()

Modify the method so that it sorts arrays where the elements are in the domain:

Integer.MIN_VALUE ≤ a[i] ≤ Integer.MAX_VALUE.Modify the method so that the "buckets" are not array length sized array-of-ints (i.e. memory hogs). You are free to implement this as you please. The following is one option: Each bucket, when used, becomes a list of

class IntNodeobjects.class IntNode { int n; IntNode next; }Note: The "buckets" 2-dimensional array switches from type

intto typeIntNodeandnullis used as EMPTY_SLOT.It is okay to rewrite this method to implement the required modifications.

## Expected Output

The output of this program should match the following.

counting_sort()... original: 7 -128 0 7 -7 127 0 7 -128 7 42 -42 sorted: -128 -128 -42 -7 0 0 7 7 7 7 42 127 radix_sort()... original: 201 -8 1024 23 301 98 -25 7 0 401 98 7 sorted: -25 -8 0 7 7 23 98 98 201 301 401 1024