//-------------------------------------------------------------------- // // Laboratory 4 ordlist.h // // Class declaration for the array implementation of the Ordered // List ADT -- inherits the array implementation of the List ADT // (Laboratory 3) // //-------------------------------------------------------------------- #ifndef ORDLIST_H #define ORDLIST_H #include #include "listarr2.cpp" class OrdList : public List { public: // Constructor OrdList ( int maxNumber = defMaxListSize ); // Modified (or new) list manipulation operations virtual void insert ( const DataType &newDataItem ) throw ( logic_error ); virtual void replace ( const DataType &newDataItem ) throw ( logic_error ); bool retrieve ( char searchKey, DataType &searchDataItem ); // Output the list structure -- used in testing/debugging void showStructure () const; // In-lab operations void merge ( const OrdList &fromL ) throw ( logic_error ); bool isSubset ( const OrdList &subL ); private: // Locates an element (or where it should be) based on its key bool binarySearch ( char searchKey, int &index ); }; #endif // #ifndef ORDLIST_H