1. Add the operation splitLinkedList to the class linkedListType as follows: void splitLinkedList (linkedList Type &sublist); //This operation divides the given list into two sublists //of (almost) equal sizes. Consider the following statements: unorderedLinkedList myList; // myList object creation unorderedLinkedList subList; || subList object creation Example 1) Suppose myList points to the list with elements 34 65 27 89 12 (in this order). Based on the following statement, myList. split LinkedList (subList); it divides myList into two sublists. In detail, myList contains the elements 34 and 65. The subList has the elements 27, 89, and 12. Example 2) If myList points to the list with elements 11 35 46 83 (in this order). The following statement myList. splitLinkedList (subList ); divides myList into two sublists: myList points to the list with the elements 11 and 35. The subList points to the sublist with the elements 46 and 83.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Asked this questions a lot trying to get an answer then compare to my own to see what errors I made, will need the code please!

1. **Add the operation `splitLinkedList` to the class `linkedListType` as follows:**

   ```cpp
   void splitLinkedList(linkedListType<Type> &subList);
   ```

   *This operation divides the given list into two sublists of (almost) equal sizes.*

   **Consider the following statements:**

   ```cpp
   unorderedLinkedList<int> myList;  // myList object creation
   unorderedLinkedList<int> subList; // subList object creation
   ```

   **Example 1**: Suppose `myList` points to the list with elements 34, 65, 27, 89, 12 (in this order).  
   Based on the following statement,

   ```cpp
   myList.splitLinkedList(subList);
   ```

   it divides `myList` into two sublists. In detail, `myList` contains the elements 34 and 65. The `subList` has the elements 27, 89, and 12.

   **Example 2**: If `myList` points to the list with elements 11, 35, 46, 83 (in this order).  
   The following statement

   ```cpp
   myList.splitLinkedList(subList);
   ```

   divides `myList` into two sublists: `myList` points to the list with the elements 11 and 35. The `subList` points to the sublist with the elements 46 and 83.

2. **Write the definition of the function template to implement the operation `splitLinkedList` in the `linkedList` header file.**

3. **Write a program (main function) that runs similar to the sample outputs in Figure 1. Please note that you must have the main function (i.e., cpp file) and linked list definitions (i.e., header files) in separate files.**

   In your main function, you must satisfy the following requirements:

   (a) Create two linked list objects (object type must be integer).  
   (b) Prompt the users to enter inputs with indicating the ending statement (use -99 to indicate the ending of the user's input).  
   (c) Print the user’s entered list with the length of the list on screen.  
   (d) Print two sub-lists (after splitting) and their lengths on screen
Transcribed Image Text:1. **Add the operation `splitLinkedList` to the class `linkedListType` as follows:** ```cpp void splitLinkedList(linkedListType<Type> &subList); ``` *This operation divides the given list into two sublists of (almost) equal sizes.* **Consider the following statements:** ```cpp unorderedLinkedList<int> myList; // myList object creation unorderedLinkedList<int> subList; // subList object creation ``` **Example 1**: Suppose `myList` points to the list with elements 34, 65, 27, 89, 12 (in this order). Based on the following statement, ```cpp myList.splitLinkedList(subList); ``` it divides `myList` into two sublists. In detail, `myList` contains the elements 34 and 65. The `subList` has the elements 27, 89, and 12. **Example 2**: If `myList` points to the list with elements 11, 35, 46, 83 (in this order). The following statement ```cpp myList.splitLinkedList(subList); ``` divides `myList` into two sublists: `myList` points to the list with the elements 11 and 35. The `subList` points to the sublist with the elements 46 and 83. 2. **Write the definition of the function template to implement the operation `splitLinkedList` in the `linkedList` header file.** 3. **Write a program (main function) that runs similar to the sample outputs in Figure 1. Please note that you must have the main function (i.e., cpp file) and linked list definitions (i.e., header files) in separate files.** In your main function, you must satisfy the following requirements: (a) Create two linked list objects (object type must be integer). (b) Prompt the users to enter inputs with indicating the ending statement (use -99 to indicate the ending of the user's input). (c) Print the user’s entered list with the length of the list on screen. (d) Print two sub-lists (after splitting) and their lengths on screen
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Lists
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.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education