top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Priority Queue Implementation in C/C++?

0 votes
550 views

An element with high priority is appears before low priority element, can someone help me to write the Priority Queue Implementation?

Thanks in advance?

posted Aug 23, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
Priority queue is a datastructure 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 low priority.

If two elements have the same priority, they are served according to their order in the queue.

I hope this helps...

1 Answer

0 votes

Theare are many ways to implement to implement a priority queue.
1. Using Heap (max or min)
2. Using singly linked list and a list header which has informations like first node
address and last node address within the header.
Along with this information header also contains current priority which is being executed.
Every time, list is traversed and process nodes associated with that priority.

answer Aug 24, 2014 by Ganesh
Similar Questions
+1 vote

Which is the most efficient implementations of a priority queue using binary trees, please provide the algorithm along with sample code.

...