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 2. 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 2 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 =0; listData ?N=ULL;
UnsortedList ();
bool full() const;
int lengthIs () const;
void makeEmpty();
void insertItem(ItemType item);
void deleteItem(ItemType item);
void print((Additional 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 2 a. Specify the file and write the prototype of member function splitList.b) Problem 2b. Specify the file and write the templated definition of new member function splitList.
 Problem 2. The templated class UnsortedList based on linked nodes is

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!