The representation of priority queue is shown in the below image. Suppose some elements occur with the same priority, they will be arranged according to the FIFO principle. It is a special type of queue data structure in which every element has a priority associated with it. It is a special type of queue in which the elements are arranged based on the priority. To know more about the circular queue, you can click the link - Priority Queue The main advantage of using the circular queue is better memory utilization. If the empty space is available in a circular queue, the new element can be added in an empty space by simply incrementing the value of rear. The drawback that occurs in a linear queue is overcome by using the circular queue. The representation of circular queue is shown in the below image. It is also known as Ring Buffer, as all the ends are connected to another end. It is similar to the linear Queue except that the last element of the queue is connected to the first element. In Circular Queue, all the nodes are represented as circular. To know more about the queue in data structure, you can click the link - Circular Queue In this case, the linear Queue shows the overflow condition as the rear is pointing to the last element of the Queue. If the first three elements are deleted from the Queue, we cannot insert more elements even though the space is available in a Linear Queue. The major drawback of using a linear Queue is that insertion is done only from the rear end. The end at which the insertion takes place is known as the rear end, and the end at which the deletion takes place is known as front end. In Linear Queue, an insertion takes place from one end while the deletion occurs from another end. There are four different types of queue that are listed as follows. Now, let's move towards the types of queue. The representation of the queue is shown in the below image. Similar approach is followed in the queue in data structure. The real-world example of a queue is the ticket queue outside a cinema hall, where the person who enters first in the queue gets the ticket first, and the last person enters in the queue gets the ticket at last. Queue can also be defined as the list or collection in which the insertion is done from one end known as the rear end or the tail of the queue, whereas the deletion is done from another end known as the front end or the head of the queue. A queue is a data structure in which whatever comes first will go out first, and it follows the FIFO (First-In-First-Out) policy. Queue is the data structure that is similar to the queue in the real world. But before moving towards the types, we should first discuss the brief introduction of the queue. Queues are used in operating systems for handling interrupts.In this article, we will discuss the types of queue.Queue are used to maintain the play list in media players in order to add and remove the songs from the play-list.Queues are used as buffers in most of the applications like MP3 media player, CD player, etc. Queues are used in asynchronous transfer of data (where data is not being transferred at the same rate between two processes) for eg.Queues are widely used as waiting lists for a single shared resource like printer, disk, CPU.There are various applications of queues discussed as below. For example, people waiting in line for a rail ticket form a queue.ĭue to the fact that queue performs actions on first in first out basis which is quite fair for the ordering of actions. Queue is referred to be as First In First Out list.ģ. A queue can be defined as an ordered list which enables insert operations to be performed at one end called REAR and delete operations to be performed at another end called FRONT.Ģ.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |