Question: C++ linked list help! 1. Create a single source file (.cpp or .cc), 2. Implement a struct called listNode before main() to represent each node

C++ linked list help!

1. Create a single source file (.cpp or .cc),

2. Implement a struct called listNode before main() to represent each node in the singly-linked list. Use a typedef before main to set the type of the element stored in the struct (set to int for this lab),

3. Write three functions, tested using the instructions below: a. Insert node takes a pointer to the first element in the list and the item to add as parameters (make sure to use the typedef for the type!). Adds the specified item to the end of the list. b. Delete node takes as parameters a pointer to the first element in the list, and takes an element (i.e., type defined by the typedef) to delete from the list if found. For simplicity, assume there are no duplicate items in the list. c. Print list takes a pointer to the first element of the list, prints the entire list from start to end.

Testing:

1.Create nodes with following values: 326 38 27 94 4 8 15

2. Delete node 94

3. Add new node 16(should be added to end)

4.Print the list.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!