Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ create a Node struct containing a string (element_name) and an int (element_count) as well as a node pointer (Node* next). Create a LinkedList

In C++ create a Node struct containing a string (element_name) and an int (element_count) as well as a node pointer (Node* next). Create a LinkedList class with the following public functions:

Constructor (with no parameters) creates an empty list.

Deconstructor deletes the list.

isEmpty checks if the list is empty.

AddData Adds a new Node to the Linked List. The new Node should be added to the front of the list.

DeleteData deletes a Node from the Linked List that contains the data specified as input parameters (name, count).

toString returns a string containing the contents of the LinkedList from the first Node to the last Node. For example:

 [Cat, 6] -> [Dog, 18] -> [Fish, 12] 

The class should also contain the following private member variables:

Node* first a pointer to the beginning of the LinkedList

Node *last a pointer to the end of the LinkedList (this variable may be useful but is optional)

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

Step: 3

blur-text-image

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

Databases In Networked Information Systems 6th International Workshop Dnis 2010 Aizu Wakamatsu Japan March 2010 Proceedings Lncs 5999

Authors: Shinji Kikuchi ,Shelly Sachdeva ,Subhash Bhalla

2010th Edition

3642120377, 978-3642120374

More Books

Students also viewed these Databases questions

Question

=+7 How has the COVID-19 pandemic impacted the operations of IHRM?

Answered: 1 week ago