1.

Write an algorithm to insert a data element at the rear end of the queue.

Answer»

Step 1: if REAR >= N -1 then
Print “Queue is overflow”
Exit
End of if
Step 2: REAR = REAR + 1
Step 3: QUEUE [REAR] = element
Step 4: if FRONT = -1 then
FRONT = 0



Discussion

No Comment Found

Related InterviewSolutions