CS2851 -- Lab 2: Benchmarking

Outcomes Addressed

  • be able to analyze the time complexity of algorithms, both sequential and recursive. (just the sequential part)

Procedure

You are to explore the impact of selecting various data structures on the exectution time of various operations. You will need to write very little code. Instead, the focus of this assignment is on the analysis of the benchmarking results.

Containers

You should compare the following containers: ArrayList<Integer>, SortedArrayList<Integer> (found here), and LinkedList<Integer>. All of these containers implement the List<Integer> interface.

Operations

You should compare the time it takes to complete the following operations on each container type:

  • Add N (random valued) positive integers to an empty container.
  • Determine whether a given integer value is in a container of size N.
  • Access the ith element of a container of size N where i is between 0 and N
  • Access the (N/2)th element of a container of size N

Size of N

You should run all of the tests for a number of values of N. The size of N and the number of specific values of N that you choose to test should be selected so that you are able to accurately predict the growth rate of the operations under examination.

Provided Classes

To help get you started, three classes have been provided:

  • Driver (download) -- Main program
  • Benchmarker (download) -- Used to benchmark operations
  • SortedArrayList (download) -- Additional collection class that is not part of the Java Collections Framework

Create an Eclipse project and add these classes to your project. No other classes are needed.

Assignment

You must run all of the tests for a number of values of N. The version of the Driver class available for download just runs test for the ArrayList class. You will need to modify the Driver class in order to test the other collections and vary the value of N. Pick a sufficient range of values for N so that you are able to accurately predict the growth rate of the operations being tested. At a minimum, N should include the range of values from 1 to 100,000.

Please note that SortedArrayList class does not support adding elements to the front of the collection, so you'll need to modify the Driver class to skip that test when working with the SortedArrayList.

Be aware that you may need to allocate a sufficient (think several hours) for the program to run to completion for certain collection classes.

Report demo (due 7:00pm, Monday of week 3 (9/22))

You must demonstrate that you can view and edit (place your names in the author positions) the Here lab report template file for this assignment.

Lab report (due 4:00pm, Friday of week 3 (9/26))

Here is a template file to use as a starting point for this report.

Your report should include:

  • Results: You should include at least one plot for each method being analyzed. The plot should be in the form of a .png or .jpg image.
  • A discussion of:
    • The parameters for each test (size, number of runs, etc.)
    • Your results... any surprises? Be sure to point out and attempt to explain anything unusual/unexpected in the plots.
    • Analysis and conclusions based on your results. Did you gather enough data to support your conclusions?
  • The Documented source code for your driver program.
  • Be sure to log the time you spend on this project in the FAST system.

As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic submission guidelines. (You may wish to consult the XML help video and/or sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost.

If you have any questions, consult your professor.

  • © 2001-2009 Dr. Christopher C. Taylor •
  • Office: L-343 •
  • Phone: 277-7339 •
  • npǝ˙ǝosɯ@ɹolʎɐʇ