Computer & Technology
Queue, Queue operations and Queue application
Computer & Technology
Queue concept is used in almost all the programming languages like C, C++, and JAVA. Queue uses the order FIFO (first-In-First-Out) by using the enqueue and dequeue operations. This article explains all about the queue, its various operations and the areas where the queue is used
Queue is the concept used in data structures. It is also referred to the linear data structure as the object or item can be added in one terminal and the item can be retrieved from the other end. Item, which is added to one end, is called as REAR and the item that is retrieved from the other end is called as FRONT. Queue is used in array as well as in linked list of the computer programs mainly used by the programmers. Queue follows the concept of
. It means that the items, which are enters first will be accessed or retrieved first.
The best example to represent the queue is the print jobs. Consider the systems are connected in the network with the common print using the print share methodology. So, whenever the users give their documents for printing, the jobs will be stored in a queue and the job which first enters the print queue will be printed first, which complies the concept of queue FIFO.
The following are operations performed by queue in data structures
Enqueue (Add operation)
Dequeue (Remove operation)
This operation is used to add an item to the queue at the rear end. So, the head of the queue will be now occupied with an item currently added in the queue. Head count will be incremented by one after addition of each item until the queue reaches the tail point. This operation will be performed at the rear end of the queue.
This operation is used to remove an item from the queue at the front end. Now the tail count will be decremented by one each time when an item is removed from the queue until the queue reaches the head point. This operation will be performed at the front end of the queue.
This operation is used to initialize the queue by representing the head and tail positions in the memory allocation table (MAT).
The other primitive operations of the queue are
Is empty – Checks whether the queue is empty. (If Is empty is true, then the addition of an item is possible. If this is false, then acknowledge with the message "Queue is empty")
Is full – Checks whether the queue is full. (If Is full is true, then the removal of an item is possible. If this is false, then acknowledge with the message "Queue is full")
Destroy – Deletes the contents of the queue.
Let us now consider the following example of using the operation Enqueue and Dequeue.
A queue of an array A is initialized and now the size of the queue is 3 which represents the queue can hold a maximum of 3 items. The enqueue operation is used to add an item to the queue
Enqueue (3) – This will add an item called 3 to the queue in the front end. (Front count will be incremented by 1)
Again we are adding another item to the queue
Enqueue (5) – This will add an item called 5 to the queue (Front count will be incremented by 1)
Again we are adding the last item to the queue
Enqueue (8) – This will add an item called 8 to the queue (Now the queue has reached its maximum count and hence no more addition of an item is possible in the queue, as the queue has reached the rear end)
Now dequeue operation is performed to remove an item from the queue.
Dequeue () – This will remove the item that has been added first in the queue, i.e., the item called 3 by following the concept of FIFO. Now the queue consists of the remaining items 5 and 8 in which the object 5 will be in the front end. The dequeue operation continues until the queue is reaching its last element.
In the computer environment, the below areas where the queue concept will be implemented:
Print queue – Jobs sent to the printer
Operating system maintain queue in allocating the process to each unit by storing them in buffer
The interrupts that occurs during the system operation are also maintained in queue
The allocation of memory for a particular resources (Printer, Scanner, any hand held devices) are also maintained in queue.
What Is Data Structure And Its Operations
Implementation Of Stack Data Structure Using C Language
Read related articles:
Did you like this resource? Share it with your friends and show your love!
Responses to "Queue, Queue operations and Queue application"
No responses found. Be the first to respond...
Notify me by email when others post comments to this article.
Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
No HTML formatting and links to other web sites are allowed.
This is a strictly moderated site. Absolutely no spam allowed.
to fill automatically.
(Will not be published, but
to validate comment)
Type the numbers and letters shown on the left.
Subscribe to Email
Get Jobs by Email
Forum posts by Email
Articles by Email
Awards & Gifts
Last 7 Days
N K Ravishankara
Chaitali Ray Chaudhuri (Datta)
ISC Technologies, Kochi - India. Copyright © All Rights Reserved.