I need help Priority Queue on C Please show me how to do thi

I need help Priority Queue on C++, Please show me how to do this programming and type this programming. Thank you so much.

This is Programming question:

Implement a Priority Queue(PQ) using an UNSORTED LIST. Use an array size of 10 elements. Use a circular array: Next index after last index is 0. Add the new node to next available index in the array. When you add an element, add 1 to index (hit max index, go to index 0). Test if array in full before you add. When you remove an element, from the list, move the following elements to the left to fill in the blank, etc ( Like prior program done with LISTS ).

Solution

In computer science a priority queue is an abstract data type which is like a regular queue or stack data structure, but where additionally each element has a \"priority\" associated with it. In a priority queue, an element with high priority is served before an element with hih piority is served before an element with low priority. If two elements have the same priority, they are served according to their order in the queue. while priority queues are often implemented with heaps, they are conceptionally distinct from heaps. A priority queue is an abstract concept like \"a list\" or \"a map\"; just as a list can be implemented with a heap or a variety of other methods such as an unordered array.

A priority queue must atleast support the following operations:

insert_with_priority: add an element to the queue with an associated priority.

pull_highest_priority_element:remove the element from the queue that has the highest priority , and return it.

This is also known as \"pop_element(off)\",

\"get_maximum_element\" or \"get_front(most)_element\".

some conventions reverse the order of priorities, considering lower values to be higher priority , so this may also be known as \"get_minimum_element\", and is often referred to as \"get-min\" in the literature.

this may insteadd be specified as seperate \"peek_at_highest_priority_element\", and \"delete_element\",functions,which can be combined to produce \"pull_highest_priority _element\".

One can imagine a priority queue as a modified queue, but whn one would get the next element off the queue , but when one would get the next element off the queue the highest priority element is retrieved first.

Stacks and queues may be modeled as particular kinds of priority queues. As a reminder, here is how stacks and queues behave: stack – elements are pulled in last-in first-out-order (e.g., a stack of papers)
queue – elements are pulled in first-in first-out-order (e.g., a line in a cafeteria)
In a stack, the priority of each inserted element is monotonically increasing; thus, the last element inserted is always the first retrieved. In a queue, the priority of each inserted element is monotonically decreasing; thus, the first element inserted is always the first retrieved.

I need help Priority Queue on C++, Please show me how to do this programming and type this programming. Thank you so much. This is Programming question: Impleme

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site