There is a more recent offering of this course. This is an archive of the
course which was offered in Spring 2016-2017.
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.
You must rewrite the following methods so that they call recursive versions
to implement 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)`**
In addition, you must write test methods that verify that your implementations
of the above methods are correct.
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.
If you prefer, you may create JUnit tests instead of using the `Tester.java`
file.
## 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/).