1. [Queue already filled?]
If FRONT = NULL and REAR = N, or if FRONT = REAR + 1, then:
Write: UNDERFLOW, and Return.
2. Set ITEM : = QUEUE[FRONT]
2. Set ITEM : = QUEUE[FRONT]
3. [Find new value of REAR.]
If FRONT : = REAR, then: [ Queue has only one element to start]
If FRONT : = NULL and REAR : = NULL
Else if FRONT = N, then:
Set FRONT : = 1.
Else :
Set REAR : = REAR + 1 .
[End of If structure]
4. Return
0 comments:
Post a Comment