Step 4 - Check whether ' front Step 3 - If it is NOT EMPTY, then define an integer variable ' i' and set ' i = front'.Step 2 - If it is EMPTY, then display "Queue is EMPTY!!!" and terminate the function.Step 1 - Check whether queue is EMPTY.We can use the following steps to display the elements of a circular queue. Then check whether both front - 1 and rear are equal ( front -1 = rear), if it TRUE, then set both front and rear to ' -1' ( front = rear = -1).ĭisplay() - Displays the elements of a Circular Queue Then check whether front = SIZE, if it is TRUE, then set front = 0. Step 3 - If it is NOT EMPTY, then display queue as deleted element and increment the front value by one ( front ++).
Step 2 - If it is EMPTY, then display "Queue is EMPTY!!! Deletion is not possible!!!" and terminate the function.We can use the following steps to delete an element from the circular queue. The deQueue() function doesn't take any value as a parameter. In a circular queue, the element is always deleted from front position. In a circular queue, deQueue() is a function used to delete an element from the circular queue. Step 4 - Increment rear value by one ( rear++), set queue = value and check ' front = -1' if it is TRUE, then set front = 0.ĭeQueue() - Deleting a value from the Circular Queue.Step 3 - If it is NOT FULL, then check rear = SIZE - 1 & front != 0 if it is TRUE, then set rear = -1.Step 2 - If it is FULL, then display "Queue is FULL!!! Insertion is not possible!!!" and terminate the function.We can use the following steps to insert an element into the circular queue. The enQueue() function takes one integer value as parameter and inserts that value into the circular queue. In a circular queue, the new element is always inserted at rear position.
In a circular queue, enQueue() is a function which is used to insert an element into the circular queue.
This situation also says that Queue is Full and we cannot insert the new element because ' rear' is still at last position. Now consider the following situation after deleting three elements from the queue. The queue after inserting all the elements into it is as follows. But once the queue becomes full, we can not insert the next element until all the elements are deleted from the queue. In a normal Queue Data Structure, we can insert elements until queue becomes full.