Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify the List class (file list.h so that it has two more functions, which will allow inserts and removes from anywhere in the linked list.

Modify the List class (file list.h so that it has two more functions, which will allow inserts and removes from anywhere in the linked list. Your functions should be called: *insertMiddle * removeMiddle Your functions should have all the same features as the given insert and remove functions, except that yours each have one extra parameter. The second parameter on each of your functions should be of type int, representing the position at which to insert (or delete). Sample calls for a list of integers: .insertMiddle (345, 5); // attempts to insert the value 345 /as the 5th item in the list // attempts to delete the 10th item in the //list and captures its value into x L.removeMiddle (x, 10); For insertMiddle, if the position number is larger than the number of items in the list, just insert the item at the back. If it's too small (i.e. 0 or less), insert at the front. For removeMiddle, return false if the position is invalid (without removing anything). You can use this program to test your class:

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

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions

Question

What are the assumptions of a logistic regression model?

Answered: 1 week ago