answersLogoWhite

0


Best Answer

In CQ we utilize memory efficiently. because in queue when we delete any

element only front increment by 1, but that position is not used later. so when

we perform more add and delete operation, memory wastage increase. But in CQ

memory is utilized, if we delete any element that position is used later,

because it is circular.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

The advantage of a priority queue is that nodes can be weighted, allowing those with greater precedence to be moved towards the head of the queue, in front of those with lesser priority, rather than always being added to the tail of the queue as would happen in a normal queue.

The disadvantage is that insertions are no longer performed in constant time as new nodes must use insertion sort to find their place in the queue (behind nodes with greater or equal priority). However, if the variable weights are finite, maintaining pointers for each weight in a static array will provide constant time insertions.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

The main advantage is that nodes can be added and removed dynamically, without the need to copy the entire list to make room for new nodes. Implementing a queue as an array will require the array to be re-allocated periodically to create empty elements for new data, or to shrink the array to avoid wasting too much memory. This requires that the entire array be copied to new memory, which is detrimental to performance.

The only disadvantage to a linked list is the need to maintain pointers between the nodes, which uses more memory than an equivalent array would require. And since insertions always occur at the tail and extractions at the head, you must also maintain pointers to both nodes to permit constant time access to those nodes. However, the additional memory is more than compensated for by the fact the list can grow and shrink dynamically, without the need to copy and reallocate any nodes.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

Discussing the advantages and disadvantages of a queue is meaningless without some form of context. A queue can only represent a first in first out list of nodes, so if that is what you want to model then I can think of no disadvantages whatsoever. Enqueue and dequeue are both O(1); constant time. It's win, win, all the way...

But if you need to model a last in first out list of nodes then the queue is at a distinct disadvantage. Enqueue is still O(1), but dequeue is now O(n); linear time. Highly inefficient.

We can discuss at length the pros and cons of implementations of stacks and queues using single-linked lists, double-linked lists and deques until the cows come home, but the fact of the matter is a queue is only advantageous when you actually want to emulate a first in first out list of nodes. In all other cases it is clearly disadvantageous.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

Define circular queue. What are its advantages?

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

It's a useful data structure for prioritizing jobs in operating systems, for categorizing data and for simulations..

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

queue is lifo structure

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are advantages and disadvantages of priority queue?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

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


Minimum number of queues needed to implement the priority queue?

Separated queue for every possible priority value.


What is priority queue?

A priority queue is a collection of elements that each element has been assigned a priority and such that order in which elements are deleted and processed comes from the following riles: 1) An element of higher priority is processed before any element of lower priority. 2) Two element with the same priority are processed according to the order in which they were added to the queue.


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)

Related questions

What are advantages and disadvantages of priority?

The advantage of a priority queue is that nodes can be weighted, allowing those with greater precedence to be moved towards the head of the queue, in front of those with lesser priority, rather than always being added to the tail of the queue as would happen in a normal queue. The disadvantage is that insertions are no longer performed in constant time as new nodes must use insertion sort to find their place in the queue (behind nodes with greater or equal priority). However, if the variable weights are finite, maintaining pointers for each weight in a static array will provide constant time insertions.


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).


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.


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


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 is priority queue?

A priority queue is a collection of elements that each element has been assigned a priority and such that order in which elements are deleted and processed comes from the following riles: 1) An element of higher priority is processed before any element of lower priority. 2) Two element with the same priority are processed according to the order in which they were added to the queue.


What are advantages and disadvantages of circular queue over ordinary queue?

Circular queues are very efficient and work well with low level codes. Ordinary queues are the standard type of queue but they do not maximize memory data well.


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)


What are types of Queue?

Queue is a data structure which is based on FIFO that is first in first out. Following are the types of queue: Linear queue Circular queue Priority queue Double ended queue ( or deque )


Is cursor implementation possible in queue or stack?

yes,cursor implementation possible in priority queue.