12. Implement a complete OrderedList class to store a list of integers in ascend
ID: 3771520 • Letter: 1
Question
12. Implement a complete OrderedList class to store a list of integers in ascending order. Implement it in two different ways: 1)
using a statically allocated array as the underlying data structure, 2) using a linked list as the underlying data structure. If
necessary, provide default constructor, copy constructor, destructor and operator=(). Provide member functions for
int count(int value), bool insert(int value), int removeAll(int value), bool
getMin(int& theMin), bool getMax(int& theMax), bool removeMin(), bool
removeMax(), int getLength() and operator<<(), operator>>(). The bool return values for
insert(), getMin() etc. are used to indicate whether or not the operation was successful. For example, if an array
is the underlying data structure then you can’t insert() when the array is already full. For any implementation, you
can’t getMin(), getMax() etc. if the list is empty. For removeAll() the return value is how many occurences
were removed. Also provide an int * toArray() function that returns a dynamically allocated array with the
elements from the list. The length of the array will be the same as the return value for getLength().
Explanation / Answer
program1 :
program 2:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.