CMSC132 Summer 2017

Doubly Linked Lists

Due Date: July 3, 2016 11:59pm
Assignment Type: Closed (See Policy)

Overview

For this project you will implement a basic doubly linked and a sorted doubly linked list. Notice that no public tests are part of this project as all tests are either release or secret.

Objectives

This project will allow you practice doubly linked lists and testing.

Grading

Clarifications

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

Code Distribution

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

Specifications

Requirements

Sample Driver

The following driver and associated output provide an idea of the classes you need to implement.


package tests;

import listClasses.BasicDoubleLinkedList;
import listClasses.SortedDoubleLinkedList;

public class SampleDriver {

	public static void main(String[] args) {
		BasicDoubleLinkedList < String > basicList = new BasicDoubleLinkedList();

		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 + " ");
		}
		
		SortedDoubleLinkedList sortedList = new SortedDoubleLinkedList(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