Deletion of the person following the auxiliary pointer Pt IS accomplished in the single instruction: 

Pti.Next := Pti.Nexti.Next 

It is often practical to process a list using two pointers - a lookahead and a trailer, one following the other. In the case of deletion, it is then likely that one pointer - say pi - precedes the member to be deleted, and P 2 points to that member. Deletion can then be expressed in the single instruction: 

PIi.Next := P2i.Next 

You are, however, warned that deletions in this manner will sometimes result in the loss of usable (free) storage. A possible remedy is to maintain an explicit list of "deleted" members, pointed to by a variable Free. New variables will then be taken from this list (if it is not empty) instead of using the procedure New. A deletion of a list member now becomes a transfer of that member from the list to the free-member list. 

PIi.Next := P2i.Next; P2i.Next := Free; Free := P2 

Finally, by using the predeclared procedure Dispose, the management of deleted members can be left to the Pascal implementation. 

Dispose (Q) deallocates the identified variable Qi and destroys the identifying value Q. It is an error if Q is nil or unde­ fined. The value Q must have been created with the first form of New. 

Dispose (Q, KI, ... , Kn) deallocates the identified variant record variable Qi with active variants selected by KI, ... , Kn and destroys the identifying value Q. It is an error if Q is nil or undefined. The value Q must have been created with the sec­ ond form of New and KI, ... , Kn must select the same vari­ ants selected when Q was created. 

Chapter 11 presents Programs 11.6 and 11.7 illustrating the traversal of tree structures which are built using pointer types. 

