A Priority Queue is a queue (FIFO) where elements are enqueued with a priority. The next element dequeued from a priority queue is the oldest one with the highest priority. If there are no elements with the highest priority, then dequeue operation returns the oldest one with the second-highest priority, and so on to the lowest priority.
One use of a priority queue is to implement a message priority queue, where certain messages have a higher priority and must be delivered sooner than any messages with lower priorities. For example, message queues are used for email systems, inter-program communication, and for managing print jobs.
Implement a MessagePriorityQueue that is a struct and the functions specified in the “messagepriorityqueue.h” file in the “2018FACS5002SV/assignment-4” repository. Stubs for the functions are in the “messagepriorityqueue.c” source file. The “messagepriorityqueue.h” file also defines a Priority enum. The ordinal values of the priorities indicate the priority, with Highest (0) being the highest and Lowest (3) the lowest.
The MessagePriorityQueue manages a ArrayDeque for each priority. For this exercise, messages are strings.
A main program and unit tests are contained in the “messagepriorityqueue_main.c” file. Your implementation must pass all the unit tests.