Problem

(Splitting a linked list, at a given node, into two sublists)a. Add the following operatio...

(Splitting a linked list, at a given node, into two sublists)

a. Add the following operation to the class linkedListType:

void divideAt(linkedListType &secondList, const Type& item);//Divide the list at the node with the info item into two //sublists.//Postcondition: first and last point to the first and last // nodes of the first sublist.// secondList.first and secondList.last point to the // first and last nodes of the second sublist.

Consider the following statements:

unorderedLinkedList myList;unorderedLinkedList otherList;

Suppose myList points to the list with the elements:

34 65 18 39 27 89 12

(in this order). The statement:

myList.divideAt(otherList, 18);

divides myList into two sublists: myList points to the list with the elements 34 65, and otherList points to the sublist with the elements 18 39 27 89 12.

b. Write the definition of the function template to implement the operation divideAt. Also write a program to test your function.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT