Question 66
In a circular queue of capacity 7, assume front points to the first element and rear points to the next insertion position. If front = 4 and rear = 1, how many elements are currently in the queue?
With rear defined as the next insertion position, the number of elements is (rear - front + capacity) % capacity = (1 - 4 + 7) % 7 = 4. The occupied indices are 4, 5, 6, and 0.