Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Evens and Odds Split a list into evens and odds without creating or deleting nodes. Derive the class intLinkedList from the class unorderedLinkedList as follows:

Evens and Odds

Split a list into evens and odds without creating or deleting nodes. Derive the class intLinkedList from the class unorderedLinkedList as follows: class intLinkedList: public unorderedLinkedList 

{ public: void splitEvensOddsList(intLinkedList &evensList, intLinkedList &oddsList); // Function to rearrange the nodes of the linked list so // that evensList consists of even integers and oddsList // consists of odd integers. // Postcondition: evensList consists of even integers. // oddsList consists of odd integers. // The original list is empty. // }; Also write the definition of the function splitEvensOddsList. Note that this function does not create any new nodes, it only rearranges the nodes of the original list so that nodes with even integers are in evensList and nodes with odd integers are in oddsList. Write a program that uses class intLinkedList to create a linked list of integers and then uses the function splitEvensOddsList to split the list into two sublists. The header files linkedList.h and unorderedLinkedList.h are supplied.

Your test program should produce output similar to this:

Enter integers ending with -999 34 62 21 10 15 90 66 53 7 120 88 36 90 11 17 24 10 -999 list: 34 62 21 10 15 90 66 53 7 120 88 36 90 11 17 24 10 evensList: 34 62 10 90 66 120 88 36 90 24 10 oddsList: 21 15 53 7 11 17

Your test program should use iterators to print the lists rather than the class print functions.

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

Database And Expert Systems Applications 23rd International Conference Dexa 2012 Vienna Austria September 2012 Proceedings Part 1 Lncs 7446

Authors: Stephen W. Liddle ,Klaus-Dieter Schewe ,A Min Tjoa ,Xiaofang Zhou

2012th Edition

3642325998, 978-3642325991

More Books

Students also viewed these Databases questions

Question

Define Administration and Management

Answered: 1 week ago