Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribedusing 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

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

General Purpose of Your Speech Analyzing Your Audience

Answered: 1 week ago

Question

Ethical Speaking: Taking Responsibility for Your Speech?

Answered: 1 week ago