Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
