CMSC204-Project 3 -Circular Linked Lists Solved

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . zip solution files instantly, after Payment

Description

5/5 - (1 vote)

Project 3

For this assignment, you will need to implement –

  • A generic circular singly-linked list class with and iterator
  • A generic sorted double singly-linked list class with an iterator that inherits from your generic circular linked class

A GUI has been provided for you for this assignment to help you visualize your linked list. Your list classes will also be tested with Junit tests.

Academic Honesty Policy Reminder | Do your own work – each submitted project will be compared against other submissions from current and previous semesters.

Specifications

BasicDoubleLinkedList

This generic double single-linked list relies on a head (reference to first element of the list) and tail (reference to the last element of the list).  Both the head and the tail are set to null when the list is empty.

Both point to the same element when there is only one element in the list, and now the element’s “next” reference points to itself. A node structure has only two fields: data and the next references.

The class must only define the following entities –

  • An inner class Node
  • An inner class that implements ListIterator (for the iterator method)
  • Head and tail references
  • An integer representing the list size.

 

However only the next(), hasNext(), previous() and hasPrevious() methods of the ListIterator are required to be implemented by you.

The rest of the methods can throw the UnsupportedOperationException, such as:

public void remove() throws UnsupportedOperationException{

throw new UnsupportedOperationException();}

All the entities are defined as protected so they can be accessed by the subclass.  Follow the Javadoc that is provided.

SortedDoubleLinkedList

A generic sorted double linked list will be constructed using a provided Comparator to determine how the list is to be sorted.  It extends BasicDoubleLinkedList class.

The addToFront and the addToEnd methods will not be supported and an add method will be added that inserts to the doubly-linked list in sorted order dependent on the Comparator.  Follow the Javadoc that is provided.

Exception Handling

  • UnsupportedOperationException – this exception is a Java library exception and will be returned by the addtoFront and addToEnd implementations of the SortedLinkedList class and by the remove method of the iterator.
  • NoSuchElementException – this exception is a Java library exception and will be returned by the next function within the iterator class when there are no more elements in the linked list.

GUI

A GUI driver has been provided to help you visualize your doubly-linked lists.  Here is the minimum that must be in place in order to utilize the GUI effectively.

  • All methods in your BasicDoubleLinkedList and SortedDoubleLinkedList must be stubbed.
  • The addToFront or addToEnd method of the BasicDoubleLinkedList must be implemented to create a basic doubly-linked list.
  • The add method of the SortedDoubleLinkedList must be implemented to create a sorted doubly-linked list.
  • The toArrayList method in both the BasicDoubleLinkedList and SortedDoubleLinkedList, which returns an arraylist of the items in the list from the head of list to the tail of list. This method is used to display the contents of the lists.

Testing

  • Create a JUnit Test – BasicDoubleLinkedListTest_STUDENT.
  • Create a JUnit Test – SortedDoubleLinkedListTest_STUDENT.
  • Run provided “public” test cases
  • Anticipate “private test cases to be executed by your instructor

Programming Concepts

This project utilizes the following concepts:

  • Exception handling
  • Generic Classes
  • Doubly Linked List
  • Ordered Doubly Linked List
  • Iterators
  • Comparators

 

  • Project3-u92alu.zip