1. [List empty?] If LINK[START] = NULL, then: Write: UNDERFLOW,a nd Exit.
2. Set PTR: = LINK[START] and SAVE : = START. [Initializes pointer.]
3. Repeat while LINK[PTR] != START: [Traverse list seeking last node. ]
Set SAVE : = PTR and PTR : = LINK[PTR]. [Updates SAVE and PTR]
[End of Loop]
4. Set LINK[SAVE] : = LINK[PTR]. [removes last node.]
5. Set LINK[PTR] : = AVAIL and AVAIL : = PTR. [Returns node to AVAIL list.]
0 comments:
Post a Comment