Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help me to get a head-start on coding this in C++, and please provide explanation. Thank you. Please code in C++. The question and
Please help me to get a head-start on coding this in C++, and please provide explanation. Thank you.
Please code in C++. The question and details below :
For this assignment, you will write two implementations of a Priority Queue. 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. Your implementations will be: - Ordered Array - Unordered Array Both implementations must have identical behavior and must implement the Priorityqueue interface (provided). The implementations must have two constructors, a default constructor with no arguments that uses the DEFAULT_MAX_CAPACITY constant from the PriorityQueue interface (implemented with a pure virtual class), and a constructor that takes a single integer parameter that represents the maximum capacity of the priority queue. The PriorityQueue interface follows in Phase 2. This assignment will be implemented in two phases. Phase 1 consists of implementing the two Array classes: UnorderedArrayLi.st and orderedArrayLi.st. Your task is to write your own code for the required public functions in UnorderedArrayList. h and OrderedArrayList.h. You may add private members as needed. Some public functions may be useful for debugging purposes, but these must not interfere with the required functions. Testing your code is essential and may require more time than writing the classes. Be sure to test combinations of functions. Additional Details Each method must be as efficient as possible. That is, a O(n) is unacceptable if the method could be written with O(logn) complexity. Accordingly, the ordered array implementation must use binary search where possible, such as contains () , delete ( int obj ), and to identify the correct insertion point for new additions. 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started