CS 201: Data Structures (Winter 2017)

HW07: Sorting

Due: Wednesday, 02/08 at 22:00

This is a pair programming assignment. You have new partners. Please make sure you know who your partners are.

1. Goals

To study the performance characteristics of several sorting algorithms, and hone your analysis skills.

2. Overview

In this assignment, you'll be doing a mixture of coding, designing and performing timing experiments, and analyzing your experimental results. You'll be thinking through what timing data makes sense to collect, and writing your reasoning in a short report.

This assignment is intended to provide you with a Quantitative Reasoning Encounter (QRE). Keeping this in mind should help you understand the purpose of this assignment and what we are looking for you to do.

You'll be investigating three separate questions over the course of the assignment.

You can download the starter files.

3. Investigation A: radix sort with strings

In this section, you'll be writing a radix sort for sorting words and exploring two versions:

For simplicity, you should assume your words are lowercase and contain only the 26 characters of the alphabet. For example, here's a correctly sorted ordering of four words:
go, goat, goatherd, grab

Radix sort implementations

Create a file RadixSort.java that includes at least two methods:
/** Uses standard least significant digit radix sort to sort the words.
    @param A list of words. Each word contains only lower case letters in a-z.
    @return A list with the same words as the input argument, in sorted order.
*/
public static List<String> radixSort(List<String> words);

/** A variation on radix sort that sorts the words into buckets by their
    initial letter, and then uses standard radix sort to separately sort each
    of the individual buckets. Recombines at the end to get a fully sorted
    list.
    @param A list of words. Each word contains only lower case letters in a-z.
    @return A list with the same words as the input argument, in sorted order.
*/
public static List<String> msdRadixSort(List<String> words);
We're using static methods here because the main purpose of this class will be to do some timing experiments, not for use by others. You can have any helper methods you like.

Radix sort investigation

4. Investigation B: quick sort and small lists

5. Investigation C: Shell sort and gap distance

6. Report guidelines

7. Notes and tips

8. Submission and grading

Submit to Moodle a zip archive containing:

Grading

This assignment modified from one designed by Anna Rafferty.

Start early, have fun, and discuss questions on Moodle.