CSci 121 Lab 5: Simple Linked Lists

Objectives

There is not much to do in this lab beyond playing with the linked list class we have been discussing in class for the past couple of days, and to see if you can write a couple of methods for removing list elements.

Exercises

  1. You will want to start by downloading SimpleIntNode.java, SimpleIntLinkedList.java, LLApplet.java, and LLApplet.html. As in Lab 4, the latter will (I hope) cause the applet to run that tests some of the features of SimpleIntLinkedList. Try all the buttons, examine the lists you get, and try to understand what is happening in terms of the underlying data structure.
  2. First exercise of the day: Add a removeFirst() method to SimpleIntLinkedList. It should have no parameters, and should remove the first element of the list AND return the value stored in it.
  3. Second exercise of the day: put in a remove() method similar to the "iterator" add method, that removes the node after the current one (and returns its values).
  4. Add buttons to LLApplet.java for testing the remove methods. Try them out.
  5. Hand in a printout of any of the code you modify. SimpleIntNode.java should remain untouched.

Last modified: 2/27/07 by Frederic Green.