Question: Please help with C++ code. Please help me to get a head start on writing code for the required public functions in UnorderedArrayList.h and OrderedArrayList.h.
Please help with C++ code. Please help me to get a head start on writing code for the required public functions in UnorderedArrayList.h and OrderedArrayList.h. Do not add any public methods to the implementations.
For this ADT, removal operations. always return the object in the queue of highest priority that has been in the queue the longest. That is, no object of a given priority is ever removed as long as the queue contains one or more object of a higher priority. Within a given priority First-In-First-Out (FIFO) order must be preserved. By convention, a lower number=higher priority. If there are five priorities for a given object, 1 .. 5, then 1 is the highest priority, and 5 the lowest priority.
--------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
OrderedArrayList.h
#ifndef ORD_ARRLIST_H #define ORD_ARRLIST_H #include "AbstractList.h" //This is a header file AbstractList.h
class OrderedArrayList : public AbstractList {
private: int* array; int capacity; int currentPos;
public: OrderedArrayList(); OrderedArrayList(int initialCapacity) ; virtual bool add(int data) ; virtual bool add(int index, int data) ; virtual void clear() ; virtual bool contains(int data) ; virtual int get(int index) ; virtual int indexOf(int data) ; virtual bool isEmpty() ; virtual int remove(int index) ; virtual bool removeAll(int data) ; virtual int size() ; virtual void trimToSize() ; }; #endif
---------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
UnorderedArrayList.h
#ifndef UNORD_ARRLIST_H #define UNORD_ARRLIST_H #include "AbstractList.h"
class UnorderedArrayList : public AbstractList {
private: int* array; int capacity; int currentPos;
public:
UnorderedArrayList(); UnorderedArrayList(int initialCapacity) ; virtual bool add(int data) ; virtual bool add(int index, int data) ; virtual void clear() ; virtual bool contains(int data) ; virtual int get(int index) ; virtual int indexOf(int data) ; virtual bool isEmpty() ; virtual int remove(int index) ; virtual bool removeAll(int data) ; virtual int size() ; virtual void trimToSize() ; }; #endif
---------------------------------------------------------------------------------------------------------------------------------------------------------
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
