CSC 207 Grinnell College Spring, 2012
 
Algorithms and Object-Oriented Design
 

Algorithm Analysis

Summary

In this lab, you will analyze the complexity of some code and experimentally test your analyses.

Preparation

Load into Eclipse the java programs in the following directory:

  cd ~walker/public_html/courses/207.sp12/labs/analysis

TestAnalysis.java is the main program that calls the other pieces (Loop1.java ... Loop8.java). TestAnalysis.java allows you to conduct experiments for the subsequent exercises.

The program uses command-line input.

To supply this information, select the "Run as Configurations..." option. Once the window comes up, be sure you have selcted TestAnalysis, and select the "Arguments" tab.

For example, to run the code for Exercise 1 with n=15, you would type

  1 15
in the arguments window, and then click "Run".

Note: In this lab, a variable NUMBER_REPETITIONS is specified to repeat a segment of code NUMBER_REPETITIONS2 times. This allows reasonable timings to be compared within the accuracy of the clock.