Department of Computer
Science
CMSC132 Spring 2013
Project: Linked Lists
Due Date: Thursday March 14, 6:00 pm
Assignment Type: Closed (See
Policy)
For this project you will implement a basic linked and a sorted linked list. Notice that no public tests are part of this project as all tests are either release or secret.
This project will allow you practice linked lists and testing.
Any clarifications or corrections associated with this project will be available at Project Clarifications.
The project's code distribution is available by checking out the project named LinkedListsProject. The code distribution provides you with the following:
You are expected to implement two classes: BasicLinkedList and SortedLinkedList.The javadoc describing what you need to implement can be found at Project Javadoc.
The following driver and associated output provide an idea of the classes you need to implement.
import listClasses.BasicLinkedList;
import listClasses.SortedLinkedList;
public class SampleDriver {
public static void main(String[] args) {
BasicLinkedList<String> basicList = new BasicLinkedList<String>();
basicList.addToEnd("Red").addToFront("Yellow").addToFront("Blue");
System.out.println("First: " + basicList.getFirst());
System.out.println("Last: " + basicList.getLast());
System.out.println("Size: " + basicList.getSize());
System.out.println("Retrieve First: " + basicList.retrieveFirstElement());
System.out.println("Retrieve Last: " + basicList.retrieveLastElement());
System.out.println("Removing Red");
basicList.remove("Red", String.CASE_INSENSITIVE_ORDER);
System.out.print("Iteration: ");
for (String entry : basicList) {
System.out.print(entry + " ");
}
SortedLinkedList<String> sortedList = new SortedLinkedList<String>(String.CASE_INSENSITIVE_ORDER);
sortedList.add("Yellow").add("Red");
System.out.print("\n\nIteration (for sorted list): ");
for (String entry : sortedList) {
System.out.print(entry + " ");
}
sortedList.remove("Red");
System.out.print("\nAfter remove in sorted list first is: ");
System.out.println(sortedList.getFirst());
}
}
Output
First: Blue
Last: Red
Size: 3
Retrieve First: Blue
Retrieve Last: Red
Removing Red
Iteration: Yellow
Iteration (for sorted list): Red Yellow
After remove in sorted list first is: Yellow