1. Queue
- First In First Out (a line of people waiting for their turn)
- Insertion at the rear, Deletion at the front
- access to shared resources,(a printer), multiprogramming, auxiliary data structure for algorithms, component of other data structures
2. Operation
3. Implementation
Array-based Queue
Two variables to keep track
- f : index of the front element
- sz : number of stored elements
r : the index where you can insert a new element
= (f + sz) % N, N = the size of the array
4. Application
Round Robin Schedulers
- e = Q.dequeue() → Service element e → Q.enqueue(e)
4. ETC
- double-ended queue = deque : a queue where both insertion and deletion can be performed at both ends