Program for circular queue using linked list

broken image

The order of elements inserted is 10, 15, 22 and 50.

broken image
broken image

In above example, the last inserted node is 50 and it is pointed by ' rear' and the first inserted node is 10 and it is pointed by ' front'. In linked list implementation of a queue, the last inserted node is always pointed by ' rear' and the first node is always pointed by ' front'. The Queue implemented using linked list can organize as many data values as we want. That means, queue using linked list can work for the variable size of data (No need to fix the size at the beginning of the implementation). The queue which is implemented using a linked list can work for an unlimited number of values. A queue data structure can be implemented using a linked list data structure. Queue using an array is not suitable when we don't know the size of data which we are going to use.

broken image

That means, the amount of data must be specified at the beginning itself. The major problem with the queue implemented using an array is, It will work for an only fixed number of data values.

broken image