Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design your own linked list class to hold any datatype. The class should have member functions for appending, inserting, and deleting nodes. Don't forget to

Design your own linked list class to hold any datatype. The class should have member functions for appending, inserting, and deleting nodes. Don't forget to add a destructor that destroys the list.
After creating the linked list class add member functions to do the following:
print - The function should display all the values in the linked list.
reverse - rearranges the nodes in the list so their order is reversed.
inserting a new item at a specified position. A position of 0 means that the value willbecome the first item on the list, a position of 1 means the value will become the second item on the list, and so on. A position equal to or greater than the length of the list means the value is placed at the end of the list
a memberfunction for deleting a node at a specified position. A value of 0 for the position means the first node in the list (the current head) is deleted. The function does nothing if the specified position is greater than or equal to the length of the list
an overloaded [] operator function - This will give the linked list the ability to access nodes using a subscript, like an array. The subscript O will reference, the first node. in the list, the subscript 1 will reference the second node in the list, and so forth. The subscript of the last node will be the number of nodes minus 1.
Demonstrate the class with a driver program.

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

Pro SQL Server Administration

Authors: Peter Carter

1st Edition

1484207106, 9781484207109

More Books

Students also viewed these Databases questions