User Menu

Login

Share with

Queue is a linear data structure in which data can be added to one end and retrieved from the other. Just like the queue of the real world, the data that goes first into the queue is the first one to be retrieved. That is why queues are sometimes called asFirst-In-First-Outdata structure.

In case of stack, we saw that data is inserted both from one end but in case of Queues; data is added to one end (known as REAR) and retrieved from the other end (known as FRONT).

The data first added is the first one to be retrieved while in case of queues the data last added is the first one to be retrieved.

A few points regarding Queues:

1.Queues:It is a linear data structure; linked lists and arrays can represent it.

2.Rear:A variable stores the index number in the array at which the new data will be added (in the queue).

3.Front:It is a variable storing the index number in the array where the data will be retrieved.

In circular queue, the insertion of a new element is performed at the very first location of the queue if the last location of the queue is full, in which the first element comes just after the last element.

Advantages :It overcomes the problem of unutilized space in leaner queues, when it is implemented as arrays.