nowif you want to insert another valueit will not be possible because the queue is completely full there is no empty space where the value can be inserted consider scenario in which two successive deletions are made the queue will then be given as shown in fig figure queue after two successive deletions herefront and rear suppose we want to insert new element in the queue shown in fig even though there is space availablethe overflow condition still exists because the condition rear max still holds true this is major drawback of linear queue to resolve this problemwe have two solutions firstshift the elements to [ the left so that the vacant space can be occupied and utilized efficiently but [ [ this can be very time-consumingespecially when the queue is quite large the second option is to use circular queue in the circular queuethe [ [ first index comes right after the last index conceptuallyyou can think of [ [ circular queue as shown in fig the circular queue will be full only when front and rear max figure circular queue circular queue is implemented in the same manner as linear queue is implemented the only difference will be in the code that performs insertion and deletion front rear operations for insertionwe now have to check figure full queue for the following three conditions if front and rear max then the front rear circular queue is full look at the queue increment rear so that it points to location and insert the value here given in fig which illustrates this point figure queue with vacant locations if rear !max then rear will be incremented and the value will be inserted front rear as illustrated in fig set rear and insert the value here if front ! and rear max then it means that the queue is not full soset rear figure inserting an element in circular queue and insert the new element thereas shown step if front and rear max in fig write "overflowlet us look at fig which shows the algorithm goto step to insert an element in circular queue in step we [end of ifcheck for the overflow condition in step we make two step if front - and rear - set front rear checks first to see if the queue is emptyand second to else if rear max and front !see if the rear end has already reached the maximum set rear capacity while there are certain free locations before else set rear rear the front end in step the value is stored in the queue [end of ifat the location pointed by rear step set queue[rearval after seeing how new element is added in circular step exit queuelet us now discuss how deletions are performed in this case to delete an elementagain we check for figure algorithm to insert an element in three conditions circular queue