Queue
Queue
Stack Queue
• Operations
– MakeEmpty
– Boolean IsEmpty
– Boolean IsFull
– Enqueue (ItemType newItem)
– Dequeue (ItemType& item)
When an element is removed from the queue. It is removed from the front
index.
dequeue() {
x = Q[front] ;
front = (front + 1) % size;
return x ; }
Operations:
Enqueue(E)
Dequeue(): remove the item with the highest
priority
Find() return the item with the highest priority
Examples
Process scheduling
Few processes have more priority
Job scheduling
N Jobs with limited resources to complete Patients
treatment in emergency
Dequeue()
Find highest priority 1
Move to left Back=4 Back=3
3 5 7 4 2 5 7 4