Question: C++ please put everthing after you answer it, thanks Complete the stub file for the DoublyLinkedList implementation. Please note: Any changes to the NodeType struct,

C++ please put everthing after you answer it, thanks

Complete the stub file for the DoublyLinkedList implementation.

Please note: Any changes to the NodeType struct, not using the NodeType struct, or changing from template Type to using a specific data type will all be cause for deductions.

You are required to implement the methods:

insertFirst

insertLast

insertNode - (insert an item at a given index)

deleteNode - (remove a specific item)

The stub file contains the basic class format to implement the virtual methods from ListType. You should only need to complete the code for these four functions. Your code must maintain (or add) the node connections both forward and backward. In the double link list class these are called next and prev.

Your code must also maintain the count variable.

You may create any helper functions you like but they should contain comments explaining why they are helpfulecessary. Hint: You may find creating a private getNode(int index) function -- which returns a link to any internal node -- helpful.C++ please put everthing after you answer it, thanks Complete the stubfile for the DoublyLinkedList implementation. Please note: Any changes to the NodeTypestruct, not using the NodeType struct, or changing from template Type tousing a specific data type will all be cause for deductions. Youare required to implement the methods: insertFirst insertLast insertNode - (insert anitem at a given index) deleteNode - (remove a specific item) Thestub file contains the basic class format to implement the virtual methodsfrom ListType. You should only need to complete the code for thesefour functions. Your code must maintain (or add) the node connections bothforward and backward. In the double link list class these are called

\} template Type ListType: : back( ) const \{ assert(tail != NULL); //confirm tail exists return tail->data; //return the data of the tail node \} template void ListType>: :copyList (const ListType> \& otherList) \{ NodeType *newNode; //pointer to create a node NodeType current; //pointer to traverse the list if (head != NULL) //if the list is nonempty, make it empty destroyList(); if (otherList. head == NULL) //otherList is empty \{ head = NULL; tail = NULL; count =0; \} else \{ current = otherList. head; // current points to the count = otherList . count; // list to be copied //copy the head node head = new NodeType ; / / create the node head->data = current > data; // copy the data head->next = NULL; // set the link field of tail = head; // the node to NULL // the next node //copy the remaining list while (current != NULL) \{ newNode = new NodeType ;// create a node newNode > data = current > data; // copy the data newNode->next = NULL; // set the link of // newNode to NULL tail->next = newNode; //attach newNode after tail tail = newNode; // make tail point to //the actual tail node current = current > next; 1/ make current point //to the next node \}/ /end while \}/lend else \}//end copylist

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!