In: Computer Science
Discuss the queue data structure.
What are its unique structural and behavioral concepts?
What are its most frequently used methods?
What implementations are provided?
What practical applications does it support?
Discuss the priority queue variant.
Queue Data Structure:
Queue data structure is a linear form with both ends open. Two operations coud be performed in queue data structure which are enqueue and dequeue. Enqueue is none other than addition where as dequeue is deletion.Enqueue happens in rear end and dequeue happens in front end.
Structural and Behaviour Concept:
It follow a linear structure where operations woud be performed in a particular order. The order which it follow is FIFO-First In First Out. The element which comes in first goes out first is the behaviour of queue data structure.
Frequently Used methods:
These are the methods used frequently in queue. The methods Enqueue() and Dequeue() are used to insert and delete elemts in queue. The method Top() returns the element in the top of the queue and Isempty() returns true when queue is empty.
Implementation:
Arrays, Stacks and Linked List could be used to impement queues. Arrays are more easier when compares to others.
Practical Applications:
CPU task scheduing, where single resource is shared . Requests for this resource are handled based on FIFO.
Priority Queue:
It is similar to queue only thing that vary from normal queue structure is that priority. Based on priority tasks are handled in the queue. The high priority element will be served first in this type of queue.
Two types of priority queue:
Both type queues provide the extreme elements for priority queue.