Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Priority Queues VS Queues

How a Priority Queue a Queue Data Structure. Since it doesn't follow FIFO, shouldn't it be named Priority Array or Priority Linked LIst majorly because Priority Queues don't follow a fashion like a FIFO queue

like image 444
Abhishek Agarwal Avatar asked Nov 28 '16 06:11

Abhishek Agarwal


People also ask

Is priority queue a queue?

A priority queue is a concept like a list or a map; just as a list can be implemented with a linked list or with an array, a priority queue can be implemented with a heap or with a variety of other methods such as an unordered array.

Why is priority queue called queue?

then why are they called priority Queue? – Ayush Srivastava. Oct 18, 2013 at 15:53. Because they are "queues" in the common (non-ADT) sense of the word: they are places where members arrive, wait for their turn, and then leave.

What is the 4 types of queue?

There are four different types of queues: Simple Queue. Circular Queue. Priority Queue.

How is priority queue different from FIFO queue?

The simplest queueing discipline is called FIFO, for "first-in-first-out." The most general queueing discipline is priority queueing, in which each customer is assigned a priority, and the customer with the highest priority goes first, regardless of the order of arrival.


1 Answers

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 think this will answer your question

like image 84
afsal_p Avatar answered Nov 21 '22 05:11

afsal_p