1. [Queue already filled?]
If FRONT = 1 and REAR = N, or if FRONT = REAR + 1, then:
Write: OVERFLOW, and Return.
2. [Find new value of REAR.]
If FRONT : = NULL, then : [Queue initially empty.]
Set FRONT : = 1 and REAR : = 1
Else :
Set REAR : = REAR + 1 .
[End of If structure]
3. Set QUEUE[REAR] : = ITEM. [This inserts new element]
4. Return
0 comments:
Post a Comment