Project: Linear-time sorting

The goal of this project is to understand and implement the two great linear-time sorting algorithms, counting sort and radix sort.

Do not attempt this project until you understand counting sort and radix sort. They are not intuitive to the uninitiated, and although this project description will help you apply the concepts to this particular implementation, it will not help you understand the algorithms if you don't have a good sense of them already.

This project is found in the book as Project 3.1 on page 190.

1. Set up

Make a folder for this project and copy the starter code from the course folder:

cp -r ~tvandrun/Public/cs345/linear-sort/. .

Make a new project in Eclipse. You will find two folders, sorts for the sorting algorithms (both in the class Sorts) and tests for the JUnit tests. CountingSortTest and RadixSortTest are the tests to use for parts 2 and 3, respectively; SortTest contains code shared by the two of them.

2. Counting sort

Do Part (a). Follow the given steps (A)-(E) carefully. Test using CountingSortTest.

3. Radix sort

Do part (b). Test using RadixSortTest.

4. To turn in

Please copy Sorts.java to your turn-in folder /cslab/class/cs345/(your id)/linear-sort .

To keep up with the course, this should be finished by Feb 7.