| QUEUE - A List of Elements : | |||||||||||
ALGORITHM FOR ADDITION AND DELETION OF ELEMENTS |
|||||||||||
| Data structures required for circular queue : | |||||||||||
| 1. front counter which points to one position anticlockwise to the 1st element | |||||||||||
| 2. rear counter which points to the last element in the queue | |||||||||||
| 3. an array to represent the queue | |||||||||||
| add _ circular ( item,queue,rear,front) | |||||||||||
| { | |||||||||||
| rear=(rear+1)mod n; | |||||||||||
| if (front == rear ) | |||||||||||
| then print " queue is full " | |||||||||||
| else | |||||||||||
| { | |||||||||||
| queue [rear]=item; | |||||||||||
| } | |||||||||||
| } | |||||||||||
| Visual Idea of Add_Circular Operation | |||||||||||
| Prev | |||||||||||