In a circular queue, how do you increment the rear end of the queue?

Q & ACategory: Data StructureIn a circular queue, how do you increment the rear end of the queue?
Admin Staff asked 4 years ago

In a circular queue, how do you increment the rear end of the queue?
a) rear++
b) (rear+1) % CAPACITY
c) (rear % CAPACITY)+1
d) rear–

1 Answers
Admin Staff answered 4 years ago

b) (rear+1) % CAPACITY