For this assignment, you will write a computer program to implement an Abstract Data Type called Priority Queue. A priority queue is like a regular queue, but each element has a priority associated with it. In a priority queue, an element with high priority is served before an element with low priority. If two elements have the same priority, they are served according to their enqueue order in the queue.
Implement the Priority Queue as an ADT using two different underlying representations:
- Static array that stores the elements in priority order
- Linked list that stores the elements in priority order
Regardless the underlying representations (array, a linked list) your Priority Queue Class should allow any programmer to store any element (data) without understand or knowing the details of the underlying representation.
Your Priority Queue ADT should provide the following interfaces (functions)
- enqueue(element, priority, queue): add an element into the queue at the appropriate position in the queue based on the associated priority. If the priority parameter is missing, assign to the element 5 as default priority, which is the lowest
- deque(queue): remove the element with the highest priority from the queue. If two elements have the same priority, they are served according to their order in the
- peek(queue): return the element to be served from the queue without removing it
- IsRegular(queue): return true if all the current elements in the queue have the same
- size(queue): returns the total number of elements in the 6. isEmpty(queue): returns true if the queue is empty.
- isFull(queue): returns true if the queue is
- display(queue): prints all the elements in the queue with their
Grading:
- Correctness 60%
- Algorithms Design (30%)
- Pair work (10%)
Reviews
There are no reviews yet.