content_image/698608.jpg
A linked list of n persons can be represented as in Figure 10.c. Each box represents one person. 

<img src='content_image/698608.jpg'>

A variable of type Link, called Fi [st, points to the first person of the list. The Next field of the last person in the list is ni 1. Note in passing that 

Firstl.Nextl.Next 

points to the third person in the list If we assume that, for example, we can read integer data representing the heights of people, then the following code could have been u~ed to construct the above chain. 

var First, P: Link; H,': Integer; First := nil; for I := 1 to N do begin Read(H); New(l); pI.Next := First; end pI.Height := H; ],itializeOtherFields(PI); First .- P 

Note that the list grows backwards. For purposes of access, we will introduce another variable, say Pt, I)f type Link and allow it to move freely through the list. To demons!) :Ite selection, we assume there is a Person with Height equal to 1 " and access this Person. The strategy is to advance Pt via Link itntil the desired person is located: 

Pt := First; while Ptl.Height <> 175L, Pt := Ptl.Next 

In words this says, "Let Pt point to the first person. While the height of the person pointed to (identified) by Pt is not 175, assign to Pt the pointer value stored in the Next field (also a pointer variable) of the record that Pt currently identifies." 

