CSC 103 Assignment 4:
Empirical Program Timing
10PM Wednesday 23 May 2001
Start by writing program a that will insert into and search an array as fast as possible. The search method should take a single Object input and return the integer position of the object in the array. Define the the program in the class MyArraySearch.java.
Write a program to gather empirical timing for the following methods, on the following data sets:
method | data sets |
MyArray.search | arrays of sizes 0 to 500000, in increments of 10000, containing worst-case ordered Integer data values |
GeneralList.get | GeneralLists of sizes 0 to 500000, in increments of 10000, containing worst-case ordered Integer data values |
HashTable.lookup | a HashTable (using in-table collision resolution) of size 500000, containing from 0 to 500000 elements in increments of 10000 |
LookupTable.lookup | a LookupTable (using out-of-table chaining) of size 500000, containing from 0 to 500000 elements in increments of 10000. |
SortedList.get(i) | a SortedList of size 500000, containing the sorted integer values 1 through 500000, search for values of i from 0 to 500000, in increments of 10000. |
Gather the timing information in the manner illustrated in the Week 7 lab notes, and in particular the example program ListSortTimes.java. For plotting, you can use the gnuplot/xv method shown in the week 7 lab notes or some other plotting technique such as excel. In any case, you must have a scaled graph that is content equivalent to that produced by gnuplot, saved as a GIF or JPEG so it can be referenced from a javadoc comment. "Content equivalent" means the scaling has to be correct, but the exact formating details do not have to be exactly the same as gnuplot.
Write a program that defines a single class named Test with a main method, and one method for testing each of the five methods listed in the table above. In the class comment, display the timing graph for each method.
Turn in the following files to the assignment named "a4":