Priority Queue Academic Essay

Paper , Order, or Assignment Requirements

1) Write a queue class using linked list to implement the queue. Do not us the link list from STL. The queue class should be a template class and must implement enqueue and dequeue operations. It should also have a getQLength() function that returns the number of elements in the queue.

2) Write a PriQueue class that uses the queue class. The PriQueue is also a template class. It should take a parameter “levels” as input to specify the number of priority levels. The constructor should create a vector “pq” of size “levels” to create the various priority levels. pq should be a private variable. It should overload the enqueue operation from Queue class: void enqueue(T obj, int level). It allows you to specify the priority level of the object “obj” so that you can place the object in the right queue. By default, the enqueue operation puts the object in queue 0 (lowest priority). Therefore, the function void enqueue(T obj) should place the object in queue pq[0]. The dequeue operation needs to check the queues in the order of priority. The higher levels need to be served before the lower ones. As long as there is something in the higher queue, the lower queue cannot be served. (Note that there are other ways to implement priority but we are sticking to this rule).

Is this question part of your Assignment?

We can help

Our aim is to help you get A+ grades on your Coursework.

We handle assignments in a multiplicity of subject areas including Admission Essays, General Essays, Case Studies, Coursework, Dissertations, Editing, Research Papers, and Research proposals

Header Button Label: Get Started NowGet Started Header Button Label: View writing samplesView writing samples