Procedure: QINSERT_REAR (Q, F, R, N,Y)
Given F and R pointers to the front and rear elements of a queue respectively. Queue Q consisting of N elements. This procedure inserts Y at rear end of Queue.
1. [Overflow]
IF R >= N
Then write (‘OVERFLOW’)
Return
2. [Increment REAR pointer]
R <-- R + 1
3. [Insert element ]
Q[R] <-- Y
4. [Is front pointer properly set]
IF F=0
Then F <-- 1
Return