Question: using c++ Implement a doubly linked list class. The class must use a template to allow for this container to be created for any data

using c++ Implement a doubly linked list class. The class must usea template to allow for this container to be created for anyusing c++

Implement a doubly linked list class. The class must use a template to allow for this container to be created for any data type. The implementation must be done with linked lists. A head and tail pointer should be maintained for efficiency. Creating a variable should look like LinkedList x; template struct LLNode DATATYPE data; LLNode *prev; J; template class LinkedList private: //use a doubly linked-list based implementation //keep a head and tail pointer for efficiency LLNode *Head LLNode *Tail; int Count; public: //setup initial conditions LinkedList); //delete all dynamic memory, etc. -LinkedList); //Equality operator to check if two lists are equal bool operator-(const LinkedList&); //Inequality operator to check if two lists are equal bool operator !=(const Linked List&); //add x to front of list void addFront (DATATYPE) //add x to back of list void addBack (DATATYPE); //add x as the ith thing in the list //if there are less than i things, add it to the back void add (DATATYPE, int); //remove and return front item from list DATATYPE removeFront //remove and return back item from list DATATYPE removeBack(; //return value of back item (but don't remove it) DATATYPE getBack) //return value of front item (but don't remove it) DATATYPE getFront); //return how many items are in the list int length); //print all elements in the linked list void print)

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!