Question: Hi, I was tasked with creating a doubly circular linked list that follows a set of specifications. I have completed about 70% of the project

Hi, I was tasked with creating a doubly circular linked list that follows a set of specifications. I have completed about 70% of the project but am stuck on a few parts. I do NOT simply want a dump of code as I wish to complete this project on my own in order to better understand the material, however I would appreciate an explanation on the best methods to complete each of the following methods. I just want to understand the material well enough to be able to complete the project on my own. Ideally a small snippet of code and an explanation for how it works would be the most helpful, but any tips would be greatly appreciated. The format we are supposed to follow can be found here: https://pastebin.com/jqsAy2x2 and the assignment as follows: "Your task is to implement a circular doubly linked list class, without sentinels (header and trailer). Your implementation should be based on the generics framework. You can use the implementation of doubly and circular linked lists from your book or the slides as a starting point, but I recommend you try implementing it from scratch by yourself. Your class should implement all the methods from the original doubly linked list class and some additional methods as described below:

  • Default constructor -- creates an empty circular doubly linked list
  • Copy Constructor -- accepts an instance of CDList and clones it to a new CDList (deep copy)
  • size() -- returns the number of elements in the CDList
  • isEmpty() -- tests whether the CDList is empty
  • first() -- returns the first element without removing it
  • last() -- returns the last element without removing it
  • addFirst(E e) -- adds element e to the front of the list
  • addLast(E e) -- adds element e to the end of the list
  • removeFirst() -- removes and returns the first element of the list
  • removeLast() -- removes and returns the last element of the list
  • rotate() -- rotate the first element to the back of the list
  • rotateBackward() -- rotate the last element to the front of the list
  • clone() -- clone the current list in a new instance. This should be a deep clone but you don't have to follow the instructions in the book.
  • equals(CDList cd) -- check if the current instance and cd have the same sequence of elements despite having possibly different starting points.
  • attach(CDList cd) -- insert cd after the tail of the current list
  • removeDuplicates(E e) -- removes all elements that happen more than once in the list. If the tail gets deleted, the element immediately before the tail will become the new tail."

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!