Using recursion, revise the destructor in the class LinkedListso that it deletes each node of the underlying linked chain.
What will be an ideal response?
```
template
LinkedList
{
deallocate(headPtr);
headPtr = nullptr;
itemCount = 0;
} // end destructor
// Private method: Deallocates all nodes assigned to the bag.
template
voidLinkedList
{
if (nextNodePtr != nullptr)
{
Node
nextNodePtr = nextNodePtr->getNext();
delete nodeToDeletePtr;
deallocate(nextNodePtr);
} // end if
} // end deallocate
```
You might also like to view...
What is a record? What is a field? How are they represented in Access?
What will be an ideal response?
When contents of comments are too lengthy to show in a comment balloon, you can display them completely in the ________ Pane
Fill in the blank(s) with correct word
When defining a variable, the keyword ____ appears at the beginning of the statement.
A. Assign B. Declare C. Define D. Dim
List five tools that are borrowed from interaction design that can be applied during design planning stages
What will be an ideal response?