Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Objective Demonstrate an understanding of: Containers and Abstract Data Types Linked List Concepts Specification You will develop a Doubly - Linked List class based on
Objective
Demonstrate an understanding of:
Containers and Abstract Data Types
Linked List Concepts
Specification
You will develop a DoublyLinked List class based on the concepts that you have learned about linked lists. Do not inherit from the Linked List class, but feel free to duplicate any code from that class.
Start with a DLLNode class, similar to the Node class. The DLLNode class should have a self.prev attribute in addition to the attributes that a linked list node has.
Now let's work on the DoublyLinkedList class. First off, you will need to add a protected tail attribute. Your code should implement the following public methods in a class called DoublyLinkedList. Some of these will identical to the LinkedList code. Others are trivially different. Still others require quite a bit of thought to implement the self.prev attribute.
The new methods should behave in the same way that the LinkedList methods behaved. For example, removeaftercurrent should return data.
addtoheaddata
self.curr should reset to head after this action
addaftercurrentdata
removefromheaddata
self.curr should reset to head after this action
removeaftercurrent
resettohead
resettotail
moveforward
movebackward
finddata
removedata
self.curr should reset to head after this action
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started