Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ LINKEDLIST.H Create a template class (LinkedList.h) that declares a singly-linked list. This template class should be able to create a linked list of any

c++

image text in transcribed

LINKEDLIST.H Create a template class (LinkedList.h) that declares a singly-linked list. This template class should be able to create a linked list of any type of object. LinkedList class should have the following attributes: A structure (struct) ADT named ListNode, which defines a node with a value & a pointer to the next ListNode A pointer to a ListNode named head A pointer to a ListNode named tail An integer named numNodes LinkedList class should have the following member functions Constructor- should initialize head &tail to point to nothing and initialize numNodes to zero Destructor-like a "RemoveAll" function- should deallocate memory for all existing nodes getLength - should return the number of nodes in the list getNodeValue - this function accepts a position (integer) as a parameter and then returns the value (object) inside the node at that position appendNode-this function accepts a value (object) as a parameter. It creates a new node at the end of the list with the sent object inside of it and increments the number of nodes. This function does not return anything. deleteNode this function accepts a position (integer) as a parameter, which indicates the position of the node to be deleted. It updates the links of the nodes on either side of this node to be deleted. Then it deletes the node. Then, it decrements the number of nodes

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

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions

Question

Were the right people involved in the decision-making process?

Answered: 1 week ago