// CS2310 Excise 16 // Chapter 16 // // Name __________________________ SSN ______________________ // // p960 - 3: // To the SortedList2 class, add a Boolean // member function named IsPresent that searches a // list for a particular value (passed as an argument) // and returns true if the value is found. // // SPECIFICATION FILE DYNAMIC-LINKED SORTED LIST( slist2.h ) typedef int ItemType ; // Type of each component // is simple type or string type struct NodeType { ItemType item ; // Pointer to person’s name NodeType* link ; // link to next node in list } ; typedef NodeType* NodePtr; class SortedList2 { public : bool IsEmpty ( ) const ; void Print ( ) const ; void InsertTop ( /* in */ ItemType item ) ; void DeleteTop ( /* out */ ItemType& item); void Delete ( /* in */ ItemType item ); bool IsPresent(ItemType item); // PRE: item is a well defined value. // POST: Return true if item is found in the // list; false, otherwise. SortedList2 ( ) ; // Constructor ~SortedList2 ( ) ; // Destructor private : NodeType* head; } ;