Bachelor in Computer Application

Queue in data structure

• Queue is Linear Data Structure

• It follows First In First Out(FIFO) principal
• It has two pointers front and rear

Operations on Queue
Insertion:
Algorithm:
Step 1: If REAR = MAX – 1 then Write “Queue is Overflow” Goto step 4 [End of IF] Step
2: IF FRONT=-1 and REAR=-1 SET FRONT=REAR=0 ELSE SET REAR=REAR+1 [END OF IF] Step
3: SET QUEUE [REAR] = NUM Step

4: EXIT

Operations on Queue
Deletion:
Algorithm:
Step 1: IF FRONT = -1 OR FRONT>REAR Write “Queue is Underflow” ELSE SET VAL=QUEUE [FRONT] FRONT = FRONT + 1 [END OF IF] Step

Post a Comment

0 Comments