Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I have provided directions and codes below; I have mentioned To Do in the tpp file below; Please complete the codes...... Read instructions carefully please!!!
I have provided directions and codes below;
I have mentioned "To Do" in the tpp file below;
Please complete the codes......
Read instructions carefully please!!!
This code is related to linked list.
Directions You will be partially implementing the List ADT as a linked list. The List abstract class is already given to you, along with the header file for the LinkedList class, and a skeleton of its implementation file. A few operations have been given temporary, empty implementations. We will discuss how to do these in the next lecture. You are also in charge of writing your own driver program to test your LinkedList class. Be thorough with your testing by checking all the operations in different scenarios and with various data types. Notes - If you need to access the length attribute in your LinkedList class, you need to write it as - All nodes are to be treated as dynamic, meaning you have to use the new and delete operators with them - For example, to create a node, you could do Node: myode = new Node; - There are some operations that need to consider if it's invalid for it to be called: in those scenarios, make sure to throw a string exception explaining the error, like this throw string("message goes here"); - The stream insertion operator has been overloaded for the LinkedList class, meaning you can use cout on your LinkedList object to print out the nodes inside irtual nLinkedList(): I/ add the argument to the end of the list virtual void append(const T& ) override; II remove all elements in the list, resetting to the initial state virtual void clear() override; I/ return the element at the given position (argument) virtual T getelement(int) const override; II return the current length of the list virtual int getLength() const override; II insert the given element (argument 2) at If the virtual void insert(int, const T\&) override \{\} I/ determine if the list currently empty virtual bool isempty() const override; I/ remove the element at the given position (argument) virtual void remove(int) override \{\} II replace the element at the given position (argument 1) with 1/ the value given (argument 2 ) virtual void replace(int, const T& ) override; I/ overloaded stream insertion operator to make printing easier template friend ostream\& operatorread cirections carefully!!
I have provided all the information!!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started