Lab 5: Recursion

Learning Outcomes

Overview

Video Introduction

In this assignment you will develop comprehensive unit tests for several methods in the List<E> interface and rewrite several methods so that they make use of recursion.

Unit Tests

Write thorough JUnit tests for these methods in the List<E> interface:

Recursive Implementations

The repository contains the partial implementations of the ArrayList<E> and LinkedList<E> classes developed in lecture. Using these as a starting point, reimplement the following methods so that no loops are used. Use recursion instead.

Each method should call a private helper method that does the recursive call. For example, LinkedList.contains(Object target) should call a private recursive version: LinkedList.contains(Object target, Node<E> postion).

Just For Fun

Once you have completed the requirements, you may chose to implement additional methods in the ArrayList and LinkedList classes.

Acknowledgements

This assignment was originally developed by Dr. Chris Taylor.