answersLogoWhite

0


Best Answer

This chapter presents two ADTs: Queues and Priority Queues. In real life a queue is a line of customers waiting for service of some kind. In most cases, the first customer in line is the next customer to be served. There are exceptions, though. For example, at airports customers whose flight is leaving imminently are sometimes taken from the middle of the queue. Also, at supermarkets a polite customer might let someone with only a few items go first.

The rule that determines who goes next is called a queueing discipline. 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. The reason I say this is the most general discipline is that the priority can be based on anything: what time a flight leaves, how many groceries the customer has, or how important the customer is. Of course, not all queueing disciplines are "fair," but fairness is in the eye of the beholder.

The Queue ADT and the Priority Queue ADT have the same set of operations and their interfaces are the same. The difference is in the semantics of the operations: a Queue uses the FIFO policy, and a Priority Queue (as the name suggests) uses the priority queueing policy.

As with most ADTs, there are a number of ways to implement queues Since a queue is a collection of items, we can use any of the basic mechanisms for storing collections: arrays, lists, or vectors. Our choice among them will be based in part on their performance--- how long it takes to perform the operations we want to perform--- and partly on ease of implemen

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the difference between priority queue and queue?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are the difference between ascending priority queue and descending queue?

Ascending priority queue is a collection of items which can be inserted aurbitarly and which can be removed smallest item. Descending priority queue is similar to ascending priority queue but it allows the deletion of the largest item.


What is the difference between a priority queue and a circular queue?

A circular queue is similar to the normal queue with the difference that queue is circular queue ; that is pointer rear can point to beginning of the queue when it reaches at the end of the queue. A priority queue is a queue in which each element is inserted or deleted on the basis of their priority. A higher priority element is added first before any lower priority element. If in case priority of two element is same then they are added to the queue on FCFS basis (first come first serve).


Array implementation of priority queue?

the priority queue is which depends on the data stored.in which their priority is maintained by checking the forth coming values stored in the queue


What are the different types of queues?

A priority queue is a queue in which each element is inserted or deleted on the basis of their priority. A higher priority element is added first before any lower priority element. If in case priority of two element is same then they are added to the queue on FCFS basis (first come first serve). Mainly there are two kinds of priority queue: 1) Static priority queue 2) Dynamic priority queue


What is the time complexity for inserting an element into a priority queue?

The time complexity for inserting an element into a priority queue is O(log n), where n is the number of elements in the priority queue.


What is the time complexity of inserting an element into a priority queue?

The time complexity of inserting an element into a priority queue is O(log n), where n is the number of elements in the priority queue.


What is the time complexity of popping an element from a priority queue?

The time complexity of popping an element from a priority queue is O(log n), where n is the number of elements in the priority queue.


What is the process for inserting a keyword into a priority queue?

To insert a keyword into a priority queue, you first assign a priority value to the keyword based on its importance. Then, you add the keyword to the queue according to its priority, ensuring that higher priority keywords are placed at the front of the queue. This process helps in efficiently managing and accessing the keywords based on their priority levels.


Explai the nature of the various types queues in data structures?

The queue is a linear data structure where operations of insertion and deletion are performed at separate ends also known as front and rear. Queue is a FIFO structure that is first in first out. A circular queue is similar to the normal queue with the difference that queue is circular queue ; that is pointer rear can point to beginning of the queue when it reaches at the end of the queue. Advantage of this type of queue is that empty location let due to deletion of elements using front pointer can again be filled using rear pointer. A priority queue is a queue in which each element is inserted or deleted on the basis of their priority. A higher priority element is added first before any lower priority element. If in case priority of two element is same then they are added to the queue on FCFS basis (first come first serve). Mainly there are two kinds of priority queue: 1) Static priority queue 2) Dynamic priority queue A double ended queue (or deque ) is a queue where insertion and deletion can be performed at both end that is front pointer can be used for insertion (apart from its usual operation i.e. deletion) and rear pointer can be used for deletion (apart from its usual operation i.e. insertion)


Minimum number of queues needed to implement the priority queue?

Separated queue for every possible priority value.


How many minimum no of queues Rae needed to implement priority queue?

Two possible solutions: 1. Separated queue for every possible priority value. 2. One shared queue for every elements, sorted by priority.


What are the advantages of using a decrease key operation in a priority queue to efficiently manage the priority of elements?

Using a decrease key operation in a priority queue allows for efficiently changing the priority of elements. This can lead to faster updates and better performance in managing the order of elements in the queue.