CSci 2101 Problem set 4: Java classes, sorting

Due Friday, April 1 at 11:59pm (by e-mail)

Problem 1 (30 points)

Problem 14 on p. 239 specifies methods and behavior of a set. Implement and test a class Set<E> with the following differences from the one described in the book:

Use test-first development for this problem: write JUnit tests first, then implement the feature, then write a JUnit test for the next feature, etc. Submit your Set class and your JUnit class. The quality of your testing will be a part of the grade.

Problem 2 (20 points)

Use the same setup that we have used for Insertion sort and Quicksort to implement Comb sort. Comb sort sorts the array by choosing a gap and sorting subsets of elements at the gap distance using bubble sort. Then the gap gets reduced, and the process is repeated. It stops when the gap is reduced to 1, at which point just the regular bubble sort is performed.
The rationale behind this approach is to quickly eliminate small values (known as "turtles") near the end of the array since they slow down the bubble sort.

How to submit

Submit your Java file(s) to me by e-mail. The subject must be Problem Set N, where N is the problem set number. If working in a group, CC your group partner.

CSci 2101 course web site.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.