An array of size MAX_SIZE is used to implement a
circular queue. Front, Rear, and count are tracked.
Suppose front is 0 and rear is MAX_SIZE -1. How
many elements are present in the queue?
Answers
Answered by
2
Answer:
Front= rear=-1
Please mark me as the brainliest
Answered by
0
When Rear becomes MAX_SIZE – 1 then, the elements present in the queue is equal to the Max_SIZE.
Detailed Explanation:
- Queue works on the principal of FIFO i.e., First in First Out.
- Circular queue is like a ring buffer where the last element connected back to the front element and formed a circle.
- The elements are deleted always from the front position, in circular queue.
- When the front == rear and the front ==-1 in that case we set the front to zero, and the element is returned which is present.
- At the point when front becomes zero and rear becomes MAX_SIZE - 1 the elements present in the queue is equal to the MAX_SIZE of the circular queue.
Similar questions
Math,
2 days ago
Computer Science,
2 days ago
Math,
2 days ago
Math,
4 days ago
CBSE BOARD XII,
4 days ago
English,
8 months ago
Science,
8 months ago