Rules and Starter Code

Rules

  • Do not use the Java Collections (java.util.ArrayList, java.util.HashMap, and so on) in your code. Use the List and ArrayList in the list package.
  • Do not change these files: List.java, ArrayList.java, Measured.java, SortingAlgorithm.java, NullSort.java, GnomeSort.java, Set.java, ArraySet.java, and the given test files. You may add tests to the given test files.
  • Do not change the drivers, except where these pages say you may: SIZE in SortingAlgorithmDriver, and the experimentQueries method in SetDriver.
  • Do not change the data files.
  • The starter declares private helper methods in some classes, such as indexOfMax in SelectionSort and merge in MergeSort. Implement each one, and use it in your solution. Do not change their names or parameters: the auto-test calls them directly. You may add more private helpers. Do not add public methods.

Starter code

A link to download the starter code, hw1-starter.zip, will be posted on the course discussion board. Download it and unzip it. You get a folder called hw1-sort-and-search. Open this folder in your editor.

The project is set up the same way as the code for each chapter. Run all the tests from the project folder with:

scripts/test.sh

Run the tests of one class with, for example:

scripts/test.sh sorts.BubbleSortTest

Most tests fail at first. That is expected: every method you have to write throws an UnsupportedOperationException until you write it. README.md in the project describes every file.