In a circular queue implementation using array of size 5, the array index…
2025
In a circular queue implementation using array of size 5, the array index starts with 0 where front and rear values are 3 and 4 respectively. Determine the array index at which the insertion of the next element will take place.
- A.
5
- B.
0
- C.
1
- D.
2
Attempted by 252 students.
Show answer & explanation
Correct answer: B
To determine the next insertion index in a circular queue, use the formula:
(rear + 1) mod size
Given:
rear = 4 size = 5 Calculate:
(4 + 1) mod 5 = 5 mod 5 = 0
Therefore, the next insertion will take place at index 0.