Explain disadvantages of ordinary queue and how it is solved using circular queue

Explain with suitable example disadvantages of ordinary queue and how it is solved using circular queue.

When item enters and deleted from the queue, the queue gradually shifts to the right as shown in figure.

In this above situation, when we try to insert another item, which shows that the queue is full . This means that the rear index equals to MAX_QUEUE_SIZE -1. But even if the space is available at the front end, rear insertion cannot be done.

Circular queues overcome the problem of unutilized space where you can reuse the space which you have deleted.

Leave a Reply

Your email address will not be published. Required fields are marked *