
CS 1316 – Homework 6 – Linked Lists
Due: Friday June 26th, 2009 before 6pm.
Out of 100 points
This is a pair programming problem! You are expected to work with the person you have
been pared with in class, and you are both responsible for submitting the exact same code
to T-Square. You may collaborate with other students in this class. Collaboration means
talking through problems, assisting with debugging, explaining a concept, etc. You
should not exchange code or write code for others. For pair programming assignments,
you and your partner should turn in identical assignments. Collaboration at a reasonable
level will not result in substantially similar code.
Homework 6: Linked Lists
For this assignment, you will be completing several methods in the (currently
incomplete) LinkedList.java class file. Specifically, you will fill in the implementation of:
•getFirst()
•addFirst(item )
•contains( item )
•set( int n, item)
•removeNthNode( int n)
•addNode( int n, item)
The specifications and behavior for each method in this assignment are located in the
Javadoc comments inside the incomplete LinkedList.java class file. There are several
completed methods in addition to the ones that you need to implement. It is your task to
implement each of the missing methods.
While implementing the above methods, you may use existing methods in the provided
LinkedList class and the related Node<Type> class, but you may not use any methods
from java.util or any other Java libraries.
NOTE: The Node.java class is using Java Generics, so that your linked list can contain
objects of any type. The main() method in the LinkedList.java file instantiates a linked