600.226: Data Structures

Spring Semester 2006: January 30, 2006 - May 5, 2006

Assignment 4: Listing Things

Out on: February 23, 2006
Due by: March 2, 2006 by 5:59 pm for full credit (11:59 pm for 10% off, hard deadline)
Collaboration: None
Grading: Packaging 10%, Style 10%, Performance 10%, Design 20%, Functionality 50%

Overview

The fourth assignment for 600.226: Data Structures deals mostly with lists. I was going to include an application for lists as well, but I believe you have enough to do with the basic implementation and testing already. There are again some "written" problems to be answered in your README file.

Problem 1: Implementation

Your first task for this assignment is to implement a generic list NodeList<T> as outlined in lecture. The archive below contains a number of interfaces and exceptions you will need. As is to be expected, NodeList<T>, has to implement the PositionList<T> interface we provide. You have to implement the Position<T> and Iterator<T> interfaces as well; the classes you write for this purpose should both be nested inside your NodeList<T>.

You should provide a toString() method in addition to those defined in the PositionList interface. A new list into which 1, 2, and 3 were inserted using insertBack() should print as [1, 2, 3] while an empty list should print as []. Your NodeList class should also have a main method that performs basic unit testing for your implementation. Be sure to test all methods, including the behavior of forward() and backward() iterators. Also, be sure to test that the correct exceptions are thrown in error situations.

Here are the necessary interfaces and exception classes: lists.tar.gz

Problem 2: Critique

Your second task for this assignment is to write up a critique of the interfaces we defined for lists. Feel free to use other designs you know about (for example from the Java class libraries, from the text book, from libraries of other languages you know, etc.) to inform your critique. Your critique should go into your README file. We won't be hurt if you "diss" our design, just be sure that you're making a good case that you can back up.

Deliverables

Please turn in a gzip compressed tarball of your assignment; the filename should be cs226-assign-4-login.tar.gz with login replaced by your Unix login name on ugradx.cs.jhu.edu (so I would use cs226-assign-4-phf.tar.gz). The tarball should contain no derived files whatsoever (i.e. no .class files, no .html files, etc.), but allow building all derived files. Include a README file that briefly explains what your programs do and contains any other notes you want us to check out before grading.

Grading

For reference, here is a short explanation of the grading criteria. Packaging refers to the proper organization of the stuff you hand in, following the guidelines for Deliverables above. Style refers to Java programming style, including things like consistent indentation, appropriate identifiers, useful comments, suitable javadoc documentation, etc. Simple, clean, readable code is what you should be aiming for. Performance refers to how fast your program can produce the required results compared to other submissions. Design refers to proper modularization and the proper choice of algorithms and data structures. Functionality refers to your programs being able to do what they should according to the specification given above; if the specification is ambiguous and you had to make a certain choice, defend that choice in your README file.

If your programs cannot be built you will get no points whatsoever. If your programs cannot be built without warnings using javac -Xlint we will take off 10% (except if you document a very good reason). If your programs fail miserably even once, i.e. terminate with an exception of any kind, we will take off 10%.

Bonus Problem

Once you have an abstraction like PositionList<T> and an implementation like NodeList<T>, it should be straightforward to use them for stacks and queues. Write an adapter class ListStack<T> that implements the UnboundedStack<T> interface from Assignment 3 using a PositionList<T> instance; the particular implementation of PositionList<T> should be passed in the constructor of ListStack<T>. One way to check whether you succeeded or not is to adapt the Calc program from Assignment 3 to use your new ListStack<T>. You should be able to do this by changing one line in your calculator! As always, we won't give you extra points for this, but we'll give you extra kudos. :-)

Updated: $Id: assignment-4.html 344 2006-03-02 04:27:58Z phf $ Validate: XHTML CSS
Copyright © 2005-2006 Peter H. Fröhlich. All rights reserved.