Lab 3 - How Fast is Java?
Due: Monday, October 4, 2004 at 9:00 AM


Short Answers

Complete the following problems from the book and turn them in as a text file lab3.txt at the start of lab.

4.1
4.5
4.9
4.10
4.11

gnuplot

Part of your lab writeup will involve making graphs of timings you gather. You may use any software you like. One option available on our computers is gnuplot. Try out some of the examples from the gnuplot tutorial.

The file

/Network/Servers/cortland.cs.williams.edu/Volumes/Courses/cs136/labs/howfast/start.gp
in the Mac lab or
/home/faculty/terescoj/shared/cs136/labs/howfast/start.gp
on FreeBSD contains a script for gnuplot to get you started. Once you generate a postscipt file, use the command open file.ps on the Macs or gv file.ps on the FreeBSD systems to open it in a viewer. You can print it to the printer using the lpr file.ps command.

To practice, plot functions that are O(1), O(n), O(n2). In addition, copy the file unknown.dat from the same directory as the starter script. Plot the data in that file. (What do you think it represents?) You do not need to hand in any of the plots from this section.

Experiments

Do the laboratory at the end of Chapter 4. You should read and think about the lab before Wednesday. Since you will write only a few small programs, you do not need to bring a design.

Programming Hint: When you run your programs, use java -Xint. The -Xint flag will turn off dynamic optimizations. This will give you more accurate results.

Turn in a writeup of the results of your experiments as a postscript or PDF file called lab3.ps or lab3.pdf. This formal lab writeup should include:

Good technical writing style is expected. State any assumptions clearly and justify your conclusions. You should plan to spend more time gathering and analyzing data and writing your report than on the programming.

If you want to practice being a real computer scientist, you can do your writeup in the typesetting language LaTeX, which is used to generate all handouts for this course, was used to write our textbook, and is the most widely-used system for generating technical research papers. An example LaTeXdocument can be found on the FreeBSD systems at

/home/faculty/terescoj/shared/latexexample

This is not required, however, and you are free to use the document preparation tool of your choice, so long as it can include the necessary graphical objects for the writeup of step 7 of the lab procedure, and can produce a postscript or PDF file that you can submit.