Explain Circular Queue?
GIAN Tutorials
10:50 PM
Circular Queue Deletions and insertions can only be performed at front and rear end respectively, as far as linear queue is concerned. Consider the queue shown in the following figure. The Queue shown in above figure is completely filled and there can't be inserted any more element due to the condition rear == max - 1 becomes true . However, if we delete 2 elements at the front end of the queue, we still can not insert any element since the condition rear = max -1 still holds . This is the main problem with the linear queue, although we have space available in the array, but we can not insert any more element in the queue. This is simply the memory wastage and we need to overcome this problem. One of the solution of this problem is circular queue. In the circular queue, the first index comes right after the last index. You can think of a circular queue as shown in the following figure. Circular queue will be full when front = -1 and rear = max-1 . Impl