1 program

Question Set 1 (10 part class modification):
1. Simple Linked List Class
Using an appropriate definition of ListNode, design a simple linked list class with only
two member functions and a default constructor:

void add(double x);
boolean isMember(double x);
Linkedlist ( ) ;

The add function adds a new node containing x to the front (head ) of the list, while the
isMember function tests to see if the list contains a node with the value x. Test your
linked list class by adding various numbers to the list and then testing for membership.

Do not create your own linked list template. Instead, use the List from the STL to perform the actions described in the text requirements.  Use an InventoryItem class as the objects to populate your list.

2. List Copy Constructor
Modify your list class of Programming Challenge 1 to add a copy constructor. Test
your class by making a copy of a list and then testing membership on the copy.

3. List Print
Modify the list class you created in the previous programming challenges to add a
print member function . Test the class by starting with an empty list, adding some
elements, and then printing the resulting list out .

4. Recursive Member Check
Modify the list class you created in the previous programming challenges to use a
recursive method to check for list membership. Test your class.

5. List Member Deletion
Modify the list class you created in the previous programming challenges by adding a
function to remove an item from the list and by adding a destructor:

void remove(double x);
– Linkedlist() ;
Test the class by adding a sequence of instructions that mixes operations for adding
items, removing items, and printing the list.

6. List Reverse
Modify the list class you created in the previous programming challenges by adding a
member function for reversing the list:

void reverse();
The member function rearranges the nodes in the list so that their order is reversed.
You should do this without creating or destroying nodes.

7. List Search
Modify the list class of Programming Challenge 1 (or later) to include a member function

int search(double x)
that returns the position of a number x on the list. The first node in the list is at position 0,
the second node is at position 1, and so on. If x is not found on the list, the search should
return -1. Test the new member function using an appropriate driver program.

8. Member Insertion By Position
Modify the list class you created in the previous programming challenges by adding a
member function for inserting a new item at a specified position:

void insert(double x, int pos);
A position of O means that x will become the first item on the list, a position of 1 means
that x will become the second item on the list, and so on. A position equal to, or greater
than, the length of the list means that the x is placed at the end of the list.

9. Member Removal by Position
Modify the list class you created in the previous programming challenges by adding a
member function for deleting a node at a specified position:
void remove(int pos);
A value of O for the position means that the first node on the list (the current head ) is
deleted. The function does nothing if the value passed for pos is greater than or equal
to the length of the list.

Possible format of code is uploaded, please include simple explanation through comments.