Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Program, assume a helper function and main have been implemented already Problem 2 Task: Write a program that creates a linked list of integers
C++ Program, assume a helper function and main have been implemented already
Problem 2 Task: Write a program that creates a linked list of integers and then splits it into two lists, one containing the even integers and one containing the odd integers. You may implement all of this in a main function. Requirements: 1. Implement an print function: (you may change the function header below to suit your implementation) void print(Node *head); // example declaration The print function should print the elements of a linked list in order from beginning to end. 2. Write a main function that creates a linked list of integers, then splits it into two lists as described above. Then print the resulting lists to demonstrate that you performed the splitting successfully. Repeat this for several different starting linked lists to show that it works for all cases. 3. Test your function to make sure that it works in every case, no matter how many even/odd numbers are in the original linked list. Problem 2 Task: Write a program that creates a linked list of integers and then splits it into two lists, one containing the even integers and one containing the odd integers. You may implement all of this in a main function. Requirements: 1. Implement an print function: (you may change the function header below to suit your implementation) void print(Node *head); // example declaration The print function should print the elements of a linked list in order from beginning to end. 2. Write a main function that creates a linked list of integers, then splits it into two lists as described above. Then print the resulting lists to demonstrate that you performed the splitting successfully. Repeat this for several different starting linked lists to show that it works for all cases. 3. Test your function to make sure that it works in every case, no matter how many even/odd numbers are in the original linked list
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started