Implement a class for Circular Doubly Linked List (with a dummy header node) which stores integers in unsorted order. Your class definitions should look like as shown below: class CDLinkedList; class DNode { friend class CDLinkedList; private int data; private DNode next; private DNode prev; }; class CDLinkedList { private: DNode head; // Dummy header node public CDLinkedList(); // Default constructor public bool insert (int val); //Inserts val at end into the linked list.Time complexity:O(1) public bool removeSecondLastValue (); //Note: Remove the Second last val from the linked list. Time complexity: O(1) public void findMiddleValue(); // find middle value of the linklist and delete it. public void display(); // Displays the contents of linked list on screen … };
Implement a class for Circular Doubly Linked List (with a dummy header node) which stores integers in unsorted order. Your class definitions should look like as shown below:
class CDLinkedList;
class DNode {
friend class CDLinkedList;
private int data;
private DNode next;
private DNode prev;
};
class CDLinkedList {
private:
DNode head; // Dummy header node
public CDLinkedList(); // Default constructor
public bool insert (int val); //Inserts val at end into the linked list.Time complexity:O(1)
public bool removeSecondLastValue ();
//Note: Remove the Second last val from the linked list. Time complexity: O(1)
public void findMiddleValue(); // find middle value of the linklist and delete it.
public void display(); // Displays the contents of linked list on screen …
};
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images