Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

7.Starting from picture C, draw the pictures that show step by step what is needed to get to picture D. We are assuming the part

7.Starting from picture C, draw the pictures that show step by step what is needed to get to picture D. We are assuming the part of the linked list shown is somewhere in the middle of a long linked list.

C D

image text in transcribed

Using your pictures, write the code to delete a node from the middle of the linked list starting from picture C. Now insert before it the code that will move currentPtr and previousPtr through the list until it finds a particular value if it exists (look at the find function from above). The previousPtr should start out as NULL and always be one node behind the currentPtr. Use your code to make a boolean function findAndDelete that is given a pointer to a linked list and a value, and if the value is in the linked list, it is deleted and the function returns true. If it is not in the list, the function returns false.

8. Expand your menu to test your three new functions. When choosing to test the find or findAndDelete functions, the user will be first asked to enter the value to find or to find and delete. Depending on whether the functions returned true or false, the main program should write an appropriate message to the user.

9. Finally write a function called deleteList that will delete all nodes in the linked list and return the parameter head set to nullptr. You can add it to the menu for testing, but also put it at the end of the program to release all dynamic memory you used.

18 8 NULL NULL currentPtr previousPt c currentPtr previousPtr

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

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions

Question

2. Discuss the steps in preparing a manager to go overseas.

Answered: 1 week ago

Question

8. Measure the effectiveness of the succession planning process.

Answered: 1 week ago