Overview

For this homework you will implement several static methods that will perform simple tasks on generic lists. We will provide you with four public tests (one for each of the routine problems)

Objectives

This project is designed to help you practice implementing recursive algorithms.  The solutions to these problems should be quite short.

Grading

The homework is worth 100 points.

Clarifications

Any clarifications or corrections associated with this project will be available at Clarifications.

Code Distribution

The project's code distribution is available by checking out the project named RecursionExercises. The code distribution provides you with the following:

Specifications

Parameterizing Static Methods

When you look in the code distribution you'll see method prototypes that look like this:

public static <T> void duplicateFirst(List<T> list)

Between the keyword "static" and the return type "void" you see <T>. This is how static methods can be parameterized for use with generic types. "T" represents a type that will be determined later when the method is invoked.

Creating Sublists of Lists

To successfully implement your methods, you will find it quite helpful to be able to generate a sublist from a List. Java makes this very easy! The List interface includes a method with the following prototype:

List<E>subList(int fromIndex, int toIndex)

Important: Note that the parameter "toIndex" is not inclusive! For example, suppose x is the list: <a, b, c, d, e>. Then x.subList(2, 4) would give you the sublist: <c, d>,not the sublist <c, d, e> as you might have expected.(This may remind you of the subString method of the String class.)

Methods for you to Implement

You will implement the following methods:

Requirements