Lab 13

Recursion

April 20, 2006

Lab Partners

Everyone should work with one lab partner on this assignment.

Purpose

The purpose of this week's in-lab is to give you hands-on experience with recursion.

Preliminaries

At the beginning of the lab, create a BlueJ project named inlab13 and place the following files into it:

Examine the code and run it. If you have any questions about what the code does or how it does it, please ask your lab TA or lab consultant.

Task

  1. 3 points. Modify the print() method in the LinkedList class so that it performs its task recursively.
  2. 3 points. Modify the add() method in the LinkedList class so that it performs its task recursively.
  3. 4 points. Provide the code for the remove() method in the LinkedList class. The code should remove all occurrences of data recursively. Uncomment the comments in the main method of the Driver class to test your solution. There are four calls to the remove() method from main. For each of the calls that works correctly, you will earn 1 point.

What to Submit

E-mail just your modified LinkedList.java file to your lab TA with the subject CS221-xx inlab13 your-names.

Before Lab Ends

Delete any BlueJ projects that you created and empty the recycle bin. Thanks.