#Day23 #100DaysOfCode
Circular queue is an extension of a normal queue which solves the drawback of empty spaces a normal queue has. When dequeueing, only the front index moves in normal queues. Even if there are empty spaces at the front, if the queue is already full (i.e: rear index reaches size-1), new elements cannot be inserted.
In circular queue, when queue is full and there are empty spaces at the front, rear index is updated to 0. New elements can be inserted up to front-1.
Circular queue can be referred as 'buffer ring'.
Circular queue is an extension of a normal queue which solves the drawback of empty spaces a normal queue has. When dequeueing, only the front index moves in normal queues. Even if there are empty spaces at the front, if the queue is already full (i.e: rear index reaches size-1), new elements cannot be inserted.
In circular queue, when queue is full and there are empty spaces at the front, rear index is updated to 0. New elements can be inserted up to front-1.
Circular queue can be referred as 'buffer ring'.