
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

COMP380 Section 71 - Data Structures I - Spring, 2007
Instructor: Bob Goldstein (617) 912- [email protected] [email protected] http://home.comcast.net/~goldsteinr/Courses/index.html http://goldstein.eri.harvard.edu/courses/index.html http://myweb.wit.edu/goldsteinr/Courses/index.html Due Date: February 13, 2007 Hand In: Printout of program code and dialogue of how it runs. Purpose: This homework is intended to compare the time it takes to run various sort algorithms. Compare three sorts: (1) home-grown bubble sort (2) home grown selection sort and (3) built-in Java Arrays sort facility Description: The items that you will be sorting are the Clothing objects that you created in Homework 2. You need to test the sort performance on arrays of length 10,100,1000, 10000, and 100000 randomly generated clothing objects. Here are the things you need to do to accomplish this homework: (1) Re-write the bubble sort and the selection sort methods so that they can be used to sort arrays of any object that implements “comparable”. Use the SortSSN example we did in class to see how to do this. (2) Add the compareTo() method to the Clothing class. (3) Make a method that generates a random list of the Clothing objects (4) Use the Timing class of Fort and Topp to time each sort. Extra Credit: Make a graph of the results (you can use a log-linear graph). You can use Excel to make the graphs /app/work/qkd27z-378475-2765031-homework3-doc.doc 1 11/28/2020 11/28/