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. Write the definition of the function template to implement the opera- tion divideAt. Also, write a program to test your function.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter18: Stacks And Queues
Section: Chapter Questions
Problem 16SA
icon
Related questions
Question

Please write a full C++ and name the multiple files. Also, include the actual code and not a screenshot please. Please provide the code itself and not just the output

 

(Splitting a linked list, at a given node, into two sublists)
Add the following operation to the class linkedList Type:
&secondList,
void divideAt (linkedListType<Type>
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<int>
myList;
unorderedLinkedList<int> otherList;
Transcribed Image Text:(Splitting a linked list, at a given node, into two sublists) Add the following operation to the class linkedList Type: &secondList, void divideAt (linkedListType<Type> 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<int> myList; unorderedLinkedList<int> 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 opera-
tion divideAt. Also, write a program to test your function.
Transcribed Image Text: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 opera- tion divideAt. Also, write a program to test your function.
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Linked List Representation
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning