Question: Doubly Linked List implementation 1. Defining class DNode A list contain a head which is a pointer (reference) to the first node and a Tail





Doubly Linked List implementation 1. Defining class DNode A list contain a head which is a pointer (reference) to the first node and a Tail wl last element in the list. The first step we should define a DNode Class DNode\{ E data; DNode next; DNode previous; public DNode(E data)\{ this. data = data; next = null; previous = null; \} public String tostring()\{ return data+" "; \} 2. The DoublylinkedList class - Add an element at the front of the list You have to update the tail if the list is empty! public void addFront (E){ // TODO You have to update the front if the list is empty! public void addEnd (E){ // TODO - Add an element after a value "val" in the list You have to check the list is not empty! P You have to check the value "avl" exist! P You have to update the previous of the successor! P You have to update the next of the predecessor! public void print() \{ //TODO \} - Check if the list is empty or not Remove the first element in the list 3- Student.md You have to check if the list is not emp You have to update the tail if the list You have to update the previous of th: - Remove an element in the list: P You have to check it the list is not empty! P You have to update the previous of the successorl P Youlyse to update the next of the : nradecestent
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
