There is a more recent offering of this course. This is an archive of the
course which was offered in Spring 2018.
Lab
6
Get started now
Lab 6: Recursion
## Overview
In this lab you will implement a number of methods recursively. In addition,
you will create methods to test your implementations.
## Procedure
You are provided with three Java classes:
* [**`ArrayList.java`**](ArrayList.java) — A partial implementation of
a simple `ArrayList` class.
* [**`LinkedList.java`**](LinkedList.java) — A partial implementation of
a simple `LinkedList` class.
* [**`Tester.java`**](Tester.java) — Starter code where you will write
your tests.
### Testing
With a partner, complete the `Tester.java` class to provide a full
set of tests for the following methods from the `List` interface:
* `size()`
* `get(int index)`
* `contains(Object target)`
* `indexOf(Object target)`
__NOTE: Requirements for the `Tester` class were updated 4/17/18.__
Your test program must produce a list of all of the problems revealed by the
tests or a message indicating that all test passed. You may display this
information in a GUI or to the console. You may not use JUnit tests, but
you may find some of the JUnit tests developed in lecture as a helpful
starting point for your `Tester` implementation. Something similar to
what was covered in lecture is available [here](https://faculty-web.msoe.edu/yoder/cs2852/code/class4_1_LinkedList_tests_start/LinkedListTest.java).
Be sure to include the name of your partner in the header comment for the class.
### Implementation Modifications
You must rewrite the following methods so that they call recursive versions
that provide the desired behavior. For example,
`LinkedList.contains(Object target)` should call a `private` recursive version:
`LinkedList.contains(Object target, Node position)` that indicates whether or
not `target` is found in the list between `position` and the end of the list.
* **`ArrayList.contains(Object target)`**
* **`ArrayList.indexOf(Object target)`**
* **`LinkedList.size()`**
* **`LinkedList.contains(Object target)`**
* **`LinkedList.indexOf(Object target)`**
* **`LinkedList.get(int index)`**
All three classes should be placed in a package whose name matches your
username.
## Just For Fun
Once you have completed the requirements, you may chose to implement additional
methods in the `ArrayList` and `LinkedList` classes.
## Lab Deliverables
> See your professor's instructions for details on submission guidelines and due dates.
> * Dr. Taylor's students: See below
> * All other students should refer to Blackboard
>
>If you have any questions, consult your instructor.
## Acknowledgements
This assignment was developed by [Dr. Chris Taylor](/taylor/).