Lab 7

March 4, 2004

Partners

You may work with at most one other person on this assignment. If you do, you will both receive the same grade.

Linked List Removal

The purpose of this in-lab is to give you more experience with a linked list implementation of the list ADT. To this end, please copy the code that we talked about on Wednesday, March 3rd (except for Driver.java) into a BlueJ project named Lab7. Then copy this Driver.java into Lab7. Notice that the provided code implements java.util.Iterator in the List class.

Standard Assignment (17 points possible)

The Driver.java file has been modified so that there are now calls to a remove method. Modify ListInterface, List and MyIterator to support this new method. When remove is called from Driver.java, all occurrences of the item that are in the list should be removed. Everything else about the list (including the relative ordering of the nodes), should stay the same.

Challenging Assignment (3 points possible)

Reimplement the standard assignment solution with a doubly linked list that contains both a dummy header node and a dummy trailer node. A node in a doubly linked list has one pointer to the previous node in the list and a second pointer to the next node in the list. Simplify the code as much as possible to take advantage of the doubly linked structure.

What To Submit

Before lab ends, print out any class file that you modified, as well as the output that your program produces when it runs. Once you have the printouts, call over either the lab TA or a consultant. He or she will run your program and verify that the output that your program produces matches that which is on your printout.

If Any Time Remains...

Feel free to work on the third programming assignment and get feedback from either your lab TA or one of your lab consultants.

Before You Leave

Please delete any BlueJ projects that you created and empty the recycle bin. Thank you.

Valid XHTML 1.0!