SlideShare a Scribd company logo
help
Instructions
Add the function max as an abstract function to the class arrayListType to return the largest
element of the list.
Also, write the definition of the function max in the class unorderedArrayListType and write a
program to test this function.
files:
main.cpp:
//Data: 18 42 78 22 42 5 42 57
arrayListType.h:
#ifndef H_arrayListType
#define H_arrayListType
class arrayListType
{
public:
bool isEmpty() const;
//Function to determine whether the list is empty
//Postcondition: Returns true if the list is empty;
// otherwise, returns false.
bool isFull() const;
//Function to determine whether the list is full
//Postcondition: Returns true if the list is full;
// otherwise, returns false.
int listSize() const;
//Function to determine the number of elements in
//the list.
//Postcondition: Returns the value of length.
int maxListSize() const;
//Function to determine the maximum size of the list
//Postcondition: Returns the value of maxSize.
void print() const;
//Function to output the elements of the list
//Postcondition: Elements of the list are output on the
// standard output device.
bool isItemAtEqual(int location, int item) const;
//Function to determine whether item is the same as
//the item in the list at the position specified
//by location.
//Postcondition: Returns true if list[location]
// is the same as item; otherwise,
// returns false.
// If location is out of range, an
// appropriate message is displayed.
virtual void insertAt(int location, int insertItem) = 0;
//Function to insert insertItem in the list at the
//position specified by location.
//Note that this is an abstract function.
//Postcondition: Starting at location, the elements of
// the list are shifted down,
// list[location] = insertItem; length++;
// If the list is full or location is out of
// range, an appropriate message is displayed.
virtual void insertEnd(int insertItem) = 0;
//Function to insert insertItem at the end of
//the list. Note that this is an abstract function.
//Postcondition: list[length] = insertItem; and length++;
// If the list is full, an appropriate
// message is displayed.
void removeAt(int location);
//Function to remove the item from the list at the
//position specified by location
//Postcondition: The list element at list[location] is
// removed and length is decremented by 1.
// If location is out of range, an
// appropriate message is displayed.
void retrieveAt(int location, int& retItem) const;
//Function to retrieve the element from the list at the
//position specified by location
//Postcondition: retItem = list[location]
// If location is out of range, an
// appropriate message is displayed.
virtual void replaceAt(int location, int repItem) = 0;
//Function to replace the elements in the list
//at the position specified by location.
//Note that this is an abstract function.
//Postcondition: list[location] = repItem
// If location is out of range, an
// appropriate message is displayed.
void clearList();
//Function to remove all the elements from the list
//After this operation, the size of the list is zero.
//Postcondition: length = 0;
virtual int seqSearch(int searchItem) const = 0;
//Function to search the list for searchItem.
//Note that this is an abstract function.
//Postcondition: If the item is found, returns the
// location in the array where the item is
// found; otherwise, returns -1.
virtual void remove(int removeItem) = 0;
//Function to remove removeItem from the list.
//Note that this is an abstract function.
//Postcondition: If removeItem is found in the list,
// it is removed from the list and length
// is decremented by one.
// Add the abstract function max
arrayListType(int size = 100);
//Constructor
//Creates an array of the size specified by the
//parameter size. The default array size is 100.
//Postcondition: The list points to the array, length = 0,
// and maxSize = size;
arrayListType (const arrayListType& otherList);
//Copy constructor
virtual ~arrayListType();
//Destructor
//Deallocate the memory occupied by the array.
protected:
int *list; //array to hold the list elements
int length; //variable to store the length of the list
int maxSize; //variable to store the maximum
//size of the list
};
#endif
arrayListTypeImp.cpp:
unorderedArrayListType.h:
unorderedArrayListTypeImp.cpp:

More Related Content

PDF
In C++Add the function min as an abstract function to the classar.pdf
PDF
(Unordered Sets) As explained in this chapter, a set is a collection.pdf
DOCX
Write a program to find the number of comparisons using the binary se.docx
PDF
Pleae help me with this C++ question, ill upvote thanks.Write the .pdf
PDF
All code should be in C++Using the UnsortedList class (UnsortedLis.pdf
PDF
Pleae help me with this C++ task to the required result by edit or f.pdf
DOCX
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx
PDF
Implement the ListArray ADT-Implement the following operations.pdf
In C++Add the function min as an abstract function to the classar.pdf
(Unordered Sets) As explained in this chapter, a set is a collection.pdf
Write a program to find the number of comparisons using the binary se.docx
Pleae help me with this C++ question, ill upvote thanks.Write the .pdf
All code should be in C++Using the UnsortedList class (UnsortedLis.pdf
Pleae help me with this C++ task to the required result by edit or f.pdf
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx
Implement the ListArray ADT-Implement the following operations.pdf

Similar to helpInstructionsAdd the function max as an abstract function to .pdf (20)

PDF
2.(Sorted list array implementation)This sorted list ADT discussed .pdf
DOCX
Assg 07 Templates and Operator OverloadingCOSC 2336 Sprin.docx
PDF
BackgroundIn many applications, the composition of a collection o.pdf
PDF
Using the C++ programming language1. Implement the UnsortedList cl.pdf
DOCX
Week 2 - Advanced C++list1.txt312220131197.docx
PDF
Write a class ArrayList that represents an array of integers. Init.pdf
PPTX
Unsorted Sorted List_Array.pptx
PDF
JAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdf
PDF
In C++Write a recursive function to determine whether or not a Lin.pdf
PPTX
DATA STRUCTURE CLASS 12 COMPUTER SCIENCE
PDF
Using C++I keep getting messagehead does not name a type.pdf
PDF
1- The design of a singly-linked list below is a picture of the functi (1).pdf
PPTX
3.01.Lists.pptx
PDF
maincpp include ListItemh include ltstringgt in.pdf
PDF
C++ projectMachine Problem 7 - HashingWrite a program to do the .pdf
PDF
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
PDF
In the rest of this lab, you will help build such a list class. The .pdf
PDF
Data Structures Practical File
PDF
Dividing a linked list into two sublists of almost equal sizesa. A.pdf
2.(Sorted list array implementation)This sorted list ADT discussed .pdf
Assg 07 Templates and Operator OverloadingCOSC 2336 Sprin.docx
BackgroundIn many applications, the composition of a collection o.pdf
Using the C++ programming language1. Implement the UnsortedList cl.pdf
Week 2 - Advanced C++list1.txt312220131197.docx
Write a class ArrayList that represents an array of integers. Init.pdf
Unsorted Sorted List_Array.pptx
JAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdf
In C++Write a recursive function to determine whether or not a Lin.pdf
DATA STRUCTURE CLASS 12 COMPUTER SCIENCE
Using C++I keep getting messagehead does not name a type.pdf
1- The design of a singly-linked list below is a picture of the functi (1).pdf
3.01.Lists.pptx
maincpp include ListItemh include ltstringgt in.pdf
C++ projectMachine Problem 7 - HashingWrite a program to do the .pdf
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
In the rest of this lab, you will help build such a list class. The .pdf
Data Structures Practical File
Dividing a linked list into two sublists of almost equal sizesa. A.pdf
Ad

More from almonardfans (20)

PDF
1.For the standard (reference) SpMV algorithm, does the communicatio.pdf
PDF
1.Does ZeRO propose solution for memory- or compute-bounded problem.pdf
PDF
1.Early versions of Supply chain included physical distribution and .pdf
PDF
1.A tee with 33 tips will be given, with three of them filled by�D.pdf
PDF
1.A person is said to have referent power over you to the extent tha.pdf
PDF
1. �Son precisas y veraces las afirmaciones de marketing de Smiths .pdf
PDF
1. �Qu� ventajas y desventajas encontraron las primeras plantas que .pdf
PDF
1.2 Practice (SOA Sample Q127) A company owes 500 and 1,000 to be pa.pdf
PDF
1. �Qu� evento convenci� a Netflix para cambiar a un servicio basado.pdf
PDF
1.. Todos los siguientes elementos han sido identificados como impor.pdf
PDF
1.----A method which enables the user to specify conditions to displ.pdf
PDF
1. �Cu�les son los seis pasos de un proceso de selecci�n de puestos .pdf
PDF
1.) Una mujer que tiene sangre tipo A positiva tiene una hija que es.pdf
PDF
1. �Cu�l es la diferencia entre una bacteria F + y una Hfr d. Las.pdf
PDF
1. �Cu�les de las siguientes afirmaciones sobre los or�genes de la a.pdf
PDF
1. �Cu�l es la relaci�n entre Enron y SOX La quiebra y el esc�n.pdf
PDF
1.) Imagina tres puntos en un mapa topogr�fico que est�n ubicados en.pdf
PDF
1. �Qu� es la dominancia apical 2. �Cu�l es el papel de la auxina.pdf
PDF
1. �Por qu� no hubo un plan de sucesi�n en Lakkard Leather Carl F.pdf
PDF
1. �Por qu� la nube es importante para ciudades como Dubuque mientra.pdf
1.For the standard (reference) SpMV algorithm, does the communicatio.pdf
1.Does ZeRO propose solution for memory- or compute-bounded problem.pdf
1.Early versions of Supply chain included physical distribution and .pdf
1.A tee with 33 tips will be given, with three of them filled by�D.pdf
1.A person is said to have referent power over you to the extent tha.pdf
1. �Son precisas y veraces las afirmaciones de marketing de Smiths .pdf
1. �Qu� ventajas y desventajas encontraron las primeras plantas que .pdf
1.2 Practice (SOA Sample Q127) A company owes 500 and 1,000 to be pa.pdf
1. �Qu� evento convenci� a Netflix para cambiar a un servicio basado.pdf
1.. Todos los siguientes elementos han sido identificados como impor.pdf
1.----A method which enables the user to specify conditions to displ.pdf
1. �Cu�les son los seis pasos de un proceso de selecci�n de puestos .pdf
1.) Una mujer que tiene sangre tipo A positiva tiene una hija que es.pdf
1. �Cu�l es la diferencia entre una bacteria F + y una Hfr d. Las.pdf
1. �Cu�les de las siguientes afirmaciones sobre los or�genes de la a.pdf
1. �Cu�l es la relaci�n entre Enron y SOX La quiebra y el esc�n.pdf
1.) Imagina tres puntos en un mapa topogr�fico que est�n ubicados en.pdf
1. �Qu� es la dominancia apical 2. �Cu�l es el papel de la auxina.pdf
1. �Por qu� no hubo un plan de sucesi�n en Lakkard Leather Carl F.pdf
1. �Por qu� la nube es importante para ciudades como Dubuque mientra.pdf
Ad

Recently uploaded (20)

PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Pharma ospi slides which help in ospi learning
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
master seminar digital applications in india
PPTX
Institutional Correction lecture only . . .
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PDF
RMMM.pdf make it easy to upload and study
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Complications of Minimal Access Surgery at WLH
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Lesson notes of climatology university.
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Computing-Curriculum for Schools in Ghana
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Pharma ospi slides which help in ospi learning
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
master seminar digital applications in india
Institutional Correction lecture only . . .
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
GDM (1) (1).pptx small presentation for students
RMMM.pdf make it easy to upload and study
FourierSeries-QuestionsWithAnswers(Part-A).pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Final Presentation General Medicine 03-08-2024.pptx
STATICS OF THE RIGID BODIES Hibbelers.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Complications of Minimal Access Surgery at WLH
01-Introduction-to-Information-Management.pdf
Lesson notes of climatology university.
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Computing-Curriculum for Schools in Ghana

helpInstructionsAdd the function max as an abstract function to .pdf

  • 1. help Instructions Add the function max as an abstract function to the class arrayListType to return the largest element of the list. Also, write the definition of the function max in the class unorderedArrayListType and write a program to test this function. files: main.cpp: //Data: 18 42 78 22 42 5 42 57 arrayListType.h: #ifndef H_arrayListType #define H_arrayListType class arrayListType { public: bool isEmpty() const; //Function to determine whether the list is empty //Postcondition: Returns true if the list is empty; // otherwise, returns false. bool isFull() const; //Function to determine whether the list is full //Postcondition: Returns true if the list is full; // otherwise, returns false. int listSize() const; //Function to determine the number of elements in //the list. //Postcondition: Returns the value of length. int maxListSize() const; //Function to determine the maximum size of the list //Postcondition: Returns the value of maxSize.
  • 2. void print() const; //Function to output the elements of the list //Postcondition: Elements of the list are output on the // standard output device. bool isItemAtEqual(int location, int item) const; //Function to determine whether item is the same as //the item in the list at the position specified //by location. //Postcondition: Returns true if list[location] // is the same as item; otherwise, // returns false. // If location is out of range, an // appropriate message is displayed. virtual void insertAt(int location, int insertItem) = 0; //Function to insert insertItem in the list at the //position specified by location. //Note that this is an abstract function. //Postcondition: Starting at location, the elements of // the list are shifted down, // list[location] = insertItem; length++; // If the list is full or location is out of // range, an appropriate message is displayed. virtual void insertEnd(int insertItem) = 0; //Function to insert insertItem at the end of //the list. Note that this is an abstract function. //Postcondition: list[length] = insertItem; and length++; // If the list is full, an appropriate // message is displayed. void removeAt(int location); //Function to remove the item from the list at the //position specified by location
  • 3. //Postcondition: The list element at list[location] is // removed and length is decremented by 1. // If location is out of range, an // appropriate message is displayed. void retrieveAt(int location, int& retItem) const; //Function to retrieve the element from the list at the //position specified by location //Postcondition: retItem = list[location] // If location is out of range, an // appropriate message is displayed. virtual void replaceAt(int location, int repItem) = 0; //Function to replace the elements in the list //at the position specified by location. //Note that this is an abstract function. //Postcondition: list[location] = repItem // If location is out of range, an // appropriate message is displayed. void clearList(); //Function to remove all the elements from the list //After this operation, the size of the list is zero. //Postcondition: length = 0; virtual int seqSearch(int searchItem) const = 0; //Function to search the list for searchItem. //Note that this is an abstract function. //Postcondition: If the item is found, returns the // location in the array where the item is // found; otherwise, returns -1. virtual void remove(int removeItem) = 0; //Function to remove removeItem from the list. //Note that this is an abstract function. //Postcondition: If removeItem is found in the list,
  • 4. // it is removed from the list and length // is decremented by one. // Add the abstract function max arrayListType(int size = 100); //Constructor //Creates an array of the size specified by the //parameter size. The default array size is 100. //Postcondition: The list points to the array, length = 0, // and maxSize = size; arrayListType (const arrayListType& otherList); //Copy constructor virtual ~arrayListType(); //Destructor //Deallocate the memory occupied by the array. protected: int *list; //array to hold the list elements int length; //variable to store the length of the list int maxSize; //variable to store the maximum //size of the list }; #endif arrayListTypeImp.cpp: unorderedArrayListType.h: unorderedArrayListTypeImp.cpp: