Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ You just need to modify my doublelinkedlist.h flie, i have already hava the main.cpp and list.h. please read the flie and modify the doublelinkedlist.h

C++

You just need to modify my doublelinkedlist.h flie, i have already hava the main.cpp and list.h. please read the flie and modify the doublelinkedlist.h flie only,make sure it can run

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

\} 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago