Question: T get (const unsigned intindex) const. This method accepts an integer. The method should then traverse to and return the kth node in the list.

T get (const unsigned intindex) const. This method accepts an integer. The method should then traverse to and return the kth node in the list. This is also zero based. It should throw int error (i.e. throw 1) if the index is invalid.T& operator[](const unsigned intindex) const. This is the overloaded [] operator. It is just a method, donot let the syntax scare you. Itis just a method that accepts an integer. This method is very similar to get. It should return the nodes value by reference (you dont have to do anything special for this, the T& returns it by referencefor you). It should throw int error (i.e. throw 1) if the index is invalid.voidinsert (const unsigned intindex, const T& value). This method accepts an integer and a value. The method will insert a new node at that index. Anything already at that index is automatically shifted up by one index. It can also insert at position 0 (before all nodes), and at a position just after the last node. This index is zero based, meaning it starts counting from zero. It cannot accept indexes past the end of the list. void remove(const unsigned intindex). This method accepts an integer. The method should then traverse to and delete the kth node in the list. This is zero based. Make sure you handle all scenarios (empty list, one node, first node, lastnode, and the general scenario.)void removeAllInstances(const T& value). This method accepts a value. The method should then remove all instances of that value. It cannot iterate down the list more than once, or in other words, it must traverse whileit deletes. It cannot loop which calls another method to loop and find a value to delete. (Some students have created their own privatemethod which accepts a reference to the node pointer, then updates that pointer to point to the next node in line. Note that the pointer must be passed in by reference, so that the caller can have the updated pointer as well.)

for this code

T get (const unsigned intindex) const. This method accepts an integer. The

template class DoublyLinkedList : public BaseDoublyLinkedList { public: I get(const unsigned int index) const; T& operator[](const unsigned int index) const; private: template T DoublyLinkedList::get(const unsigned int index) const { // some code here return T{}; // You don't want this, it just helps let it at least compile template T& DoublyLinkedList::operator[](const unsigned int index) const { // some code here I temp; return temp; // You don't want this, it just helps let it at least compile

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!