Array-based member function Assignment
An Unsorted Type ADT is to be extended by the addition of function SplitLists, which has the following specifications:
- Implement SplitLists as an array-based member function of the Unsorted List ADT.
{` void SplitLists(const UnsortedType& list, ItemType item, UnsortedType& list1, UnsortedType& list2) { ItemType listItem; list1.MakeEmpty(); list2.MakeEmpty(); list.ResetList(); while (!list.IsLastItem()) { list.GetNextItem(listItem); if(listItem > item) list2.InsertItem(listItem); else list1.InsertItem(listItem); } } b. Implement SplitLists as a linked member function of the Unsorted List ADT. bool IsThere(ItemType item) const; bool UnsortedType:: IsThere(itemType item) { Bool moreToSearch; Int location =0; Found = false; Moreto Search = (location < length); While(moreToSearch && !found) { switch(item.ComparedTo(info[location])) { Case LESS: Case GREATER: location ++; moreToSearch = (location < length); break; } } Return found; } `}