Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 2 . The templated class UnsortedList based on linked nodes is given below. Write the prototype and definition of member function splitList which divides
Problem The templated class UnsortedList based on linked nodes is given below. Write the prototype and definition of member function splitList which divides the current list into two lists according to a given key. The precondition and postcondition of a new member function splitList are below:
Precondition: the current list has been initialized.
Postcondition: listl contains all elements of the current list which are less than or equal to the given key. The second list contains data which are greater than the given key.
File UnsortedList.h: Header file for Unsorted List ADT.
preprocessor directives
template class ItemType
struct NodeType
Item Type info;
NodeType ItemType next;
;
template class ItemType
class UnsortedList
public:
UnsortedList length ; listData ;
UnsortedList ;
bool full const;
int lengthIs const;
void makeEmpty;
void insertItemItemType item;
void deleteItemItemType item;
void printAdditional Requirements: You are allowed to use only the public member functions makeEmpty and insertItem listed in the given UnsortedList.h file. Do not change any of the given identifiers of given file UnsortedList.h and the Postcondition. Do not add any additional member function to the class UnsortedList.a Problem a Specify the file and write the prototype of member function splitList.b Problem b Specify the file and write the templated definition of new member function splitList.
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