CS 136 Assignment 3

This assignment consists of both a written homework component and a lab component.

Written Homework

Problems 4.1-4.5 in Bailey. For each problem, give the worst-case time complexity using "big-Oh" notation, as well as a brief explanation.

Also be sure to look at problems 4.9-4.14. While you don't have to turn in solutions to these problems, you should be certain that you understand the answers, which can be found at the back of the text.

This homework is due Friday, February 25, in class.

Lab Assignment

Description

In this assignment you will implement different search algorithms and measure their performance by running a set of experiments. The assignment has two parts.

In the first part you will add two more search methods to the Java class Search that I have provided for you. Both of the methods will be similar to binary search except for the way they split the array:

Be sure to test your methods thoroughly. They should be able to handle You don't need to submit these tests, but you will be graded on correctness, so it is worthwhile to test your methods thoroughly.

The second part of the assignment will require that you design and implement an experiment that will allow measuring and comparing the performance of the four methods.

In order to compare the methods fairly, you will run them all on ordered arrays. Since the position of the target in the array is the focus of our search, rather than the target itself, you can simply run your experiments on arrays containing integers 0 to n-1 (or 1 to n, if you prefer).

The experiment design is as follows:

Note. To make the measurements described above, you will need to add counters and counting code to your methods (and/or to the class). Do this in a manner that is as transparent as possible. A user of the Search class should be able to invoke the various methods without knowing that any counting is happening!

Goals

The goals are to learn how to measure the performance of algorithms using experiments. You should prepare a design of your solution to this assignment for the lab on Wednesday. The design should include complete method headers for the two new searches, as well as pseudocode for the methods and the experiment component.

Naming Conventions

As always, remember that classes requested for assignments should always be named as in the assignment. Don't forget to follow the usual conventions for naming of methods, variables, etc.

What to hand in

The program is due Sunday, February 27 for those in a Wednesday lab, and Monday, February 28 for those in the Thursday lab. Programs are handed in by putting a folder, whose name is your last name, into the CS136 drop-off folder on Cider Press. The folder should contain the Metrowerks project folder for your Search class. Please also remember to turn in a printed copy either to me to to one of the 136 TAs.

Back to:

  • CS 136 home page
  • Andrea Danyluk's home page
  • CS Department home page
  • andrea@cs.williams.edu