Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Students also viewed these Databases questions

Question

3. Review the evidence. Do you believe the testimony presented?

Answered: 1 week ago

Question

1. What are the marketing implications of this situation?

Answered: 1 week ago