Circular Queues Flashcards

(2 cards)

1
Q

adding an item to a circular queue

A
  1. Check the queue is not already full
  2. Compare the value of the (rear) pointer with the maximum size of the array
  3. If equal then (rear) pointer becomes zero
  4. Otherwise, add one to the (rear) pointer
  5. Insert new item in position indicated by (rear) pointer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

removing an item from a circular queue

A
  1. Check the queue is (not already) empty
  2. Compare the value of the front pointer with the maximum size of the array
  3. If equal then front pointer becomes one
  4. Otherwise, add one to the front pointer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly