Data Structures and Algorithms in Java
Data Structures and Algorithms in Java
6th Edition
ISBN: 9781119278023
Author: Michael T. Goodrich; Roberto Tamassia; Michael H. Goldwasser
Publisher: Wiley Global Education US
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
Using the notation

you can select multipy options
For each of the following, decide whether the claim is True or False and select the True ones: Suppose we discover that the 3SAT can be solved in worst-case cubic time. Then it would mean that all problems in NP can also be solved in cubic time. If a problem can be solved using Dynamic Programming, then it is not NP-complete. Suppose X and Y are two NP-complete problems. Then, there must be a polynomial-time reduction from X to Y and also one from Y to X.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
CMPTR
Computer Science
ISBN:9781337681872
Author:PINARD
Publisher:Cengage