Data Structures and Algorithms in Java
Data Structures and Algorithms in Java
6th Edition
ISBN: 9781118771334
Author: Michael T. Goodrich
Publisher: WILEY
Question
Book Icon
Chapter 3, Problem 33C
Program Plan Intro

Initial consideration:

While the circularly liked list implementation has to be provided using inheritance in such a way that a DoublyLinkedList class inherits from the existing CircularlyLinkedList, and the DoublyLinkedList.Node nested class inherits from CircularlyLinkedList.Node.

The following consideration has to be made before implementation:

  • A circular version of a doubly linked list has to be implemented that is not having any sentinels that can generally supports the public behaviors of the original and new update methods.
  • The implemented circular doubly linked list should have method called rotate() which is used to rotate the linked list counter clockwise and rotateBackward() method that can support the  public behaviors of the linked list.
  • There is no need to use the sentinel nodes which are more generally useful with linked list implementation that helps to maintain the reference of all nodes of a doubly linked list.
  • The node in the circular version of doubly linked list maintains two references with the previous and the next node in the doubly linked list.

Doubly-linked list:

  • Doubly-linked list is a kind of data structure in which every node in the list has two link pointers where one link is pointing to previous node and the link will point to the next node in the list.
  • The first node in the linked list generally points to a Null pointer and the next link of the last node in the linked list is pointing to the Null.

CircularlyLinkedList:

  • Circular Linked List is also a kind of data structure where all the nodes in the list are in the formed of a circular fashion.
  • The circular pattern can be a singly or doubly linked list. Unlike doubly linked list there is no Null pointer in the circular linked list. The nodes are added and removed based on the constant time factor.
  • The main advantage of circular linked list is the ability to traverse the nodes of the linked list.

Inheritance:

  • In object-oriented programming (OOP) inheritance is a procedure to create new class from an existing class which is known as base class or super class and the inherited class is known as derived class or sub class and the new class will inherits all the properties of the existing parent class.

Blurred answer
Students have asked these similar questions
4. Suppose our MyLinkedList class represented a doubly linked list, where each Node is implemented as follows: private class Node { Node prev, next; E element; } public Node (E element) { } this.element = element; Each Node has a reference to the previous Node as well as to the next Node in the list. MINIMALLY modify the add(int index, E element) method below to work properly with the doubly linked Nodes, and highlight or underline your changes.
Use the ArrayList class Add and remove objects from an ArrayList Protect from index errors when removing Practice with input loop Details: This homework is for you to get practice adding and removing objects from an ArrayList. The Voter class was used to create instances of Voters which held their name and a voter identification number as instance variables, and the number of instances created as a static variable. This was the class diagram:   The constructor takes a string, passed to the parameter n, which is the name of the voter and which should be assigned to the name instance variable. Every time a new voter is created, the static variable nVoters should be incremented. Also, every time a new voter is created, a new voterID should be constructed by concatenating the string “HI” with the value of nVoters and the length of the name. For example, if the second voter is named “Clark Kent”, then the voterID should be “HI210” because 2 is the value of nVoters and 10 is the number…
Declare and implement 5 classes: FloatArray, SortedArray, FrontArray, PositiveArray & NegativeArray. 1- The FloatArray class stores a dynamic array of floats and its size. It has:- A parameterized constructor that takes the array size. - An add method that adds a float at the end of the array.- Overloading for the insertion operator << to write the array to afile (ofstream)- Overloading for the extraction operator >> to read the array elements from the file (ifstream) and add them to the array.- A destructor to deallocate the array2- The SortedArray inherits from FloatArray. It has:- A parameterized constructor that takes the array size. - An add method that adds a float at the right place in the arraysuch that the array remains sorted with every add. Don’t add to the array then sort but rather add in the right place.3- The FrontArray inherits from FloatArray. It has:- A parameterized constructor that takes the array size. - An add method that adds a float at the front…
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education