Circular queue[^] is implemented to overcome the limitations of Linear Queue. As name indicates, this type of queue has a logical structure of queue even though it is stored in 1D in memory. The two flags called "Front" and "Rear" gives the logical circular structure.These flags moves in circular fashion to give circular structure.
In this queue, the new item is added at position `(Rear + 1) % Size` (% - Modular Division). And check the queue "Full" and "Empty" condition using `Rear = Front`. So the queue can check whether the queue is physically full or not. So this mechanism uses memory space efficiently than linear queue.
Circular Queue implementation in CPP: http://terminalcoders.blogspot.in/2014/07/circular-queue-implementation-in-c.html
Circular Queue implementation in CPP: http://terminalcoders.blogspot.in/2014/07/circular-queue-implementation-in-c.html