











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!












This procedure inserts an element ITEM into a queue
If FRONT=1 and REAR=N , or if FRONT=REAR+ Then: write OVERFLOW and return.
If FRONT:=NULL // [then queue initially empty]
Set FRONT:=1 and REAR:= Else if REAR=N , then : Set REAR:= Else: Set REAR:=REAR+ // [end of if structure]
Set QUEUE[REAR]:=ITEM //[this inserts new element]
RETURN
This procedure deletes an element from a queue and assign it to the variable item
If FRONT:=NULL Then: write UNDERFLOW and return
2)Set ITEM:=QUEUE[FRONT]
if FRONT=REAR , then: //[queue has only one element] Set FRONT:=NULL and REAR:=NULL else if FRONT=N, then: set FRONT:= else set FRONT:=FRONT+ //[end of if structure]