Homework 1
22C:21 Computer Science II: Data Structures
Due Friday, February 1, 2008
1. Modify and test the SortTest.java program in
the following ways:
- complete the MixArray method so that it does a reasonable job mixing your array. Use
random number generation to help with this (look in RandomTest method for example use of randomization
methods).
- sort arrays of several different sizes and use timing functions (see TimingTest for sample
code) to see how long it takes to sort arrays of different sizes.
Electronically submit your program according to the guidelines on the class WWW home page.
2. Give a short write-up analyzing your timing results (this should be a separate document from
the required README file describing your program.) The write-up should include
a list of the timing data and also a simple graph plotting array size versus running time.
Mathematically, what can you say about how, approximately, the running time grows with
respect to the array size? Approximately how long do think it would take your program to
sort 10,000,000 items? 100,000,000 items? 1,000,000,000 items? (Assume that you'd do this
on the same computer as your original tests and also that the computer had enough memory
to handle such large arrays.)