Complete the code to initialize the front index of the circular queue.
front := [1]The front index is initialized to -1 to indicate the queue is empty.
Complete the code to check if the circular queue is full.
if (rear+1) % size == [1] {
The queue is full when the next position of rear equals front.
Fix the error in updating the rear index after enqueue operation.
rear = (rear [1] 1) % size
We add 1 to rear and use modulo to wrap around the array.
Fill both blanks to correctly update front and rear when queue becomes empty after dequeue.
if front == rear { front = [1] rear = [2] }
When the last element is removed, both front and rear reset to -1 to show empty queue.
Fill all three blanks to correctly implement the dequeue operation steps.
if front == -1 { return -1 // Queue is empty } value := queue[front] if front == rear { front, rear = [1], [2] } else { front = (front [3] 1) % size } return value
If only one element was in queue, reset front and rear to -1. Otherwise, move front forward by 1 with wrap-around.
