generatedstarting with the empty lista heading element is added repeatedly the process of list generation is expressed in by the following piece of programhere the number of elements to be linked is :nil(*start with empty list*while do new( ) next :pp :qq key :ndec(nend this is the simplest way of forming list howeverthe resulting order of elements is the inverse of the order of their insertion in some applications this is undesirableand consequentlynew elements must be appended at the end instead of the head of the list although the end can easily be determined by scan of the listthis naive approach involves an effort that may as well be saved by using second pointersay qalways designating the last element this method isfor exampleapplied in the program crossref (sec )which generates cross-references to given text its disadvantage is that the first element inserted has to be treated differently from all later ones the explicit availability of pointers makes certain operations very simple which are otherwise cumbersomeamong the elementary list operations are those of inserting and deleting elements (selective updating of list)andof coursethe traversal of list we first investigate list insertion assume that an element designated by pointer (variableq is to be inserted in list after the element designated by the pointer the necessary pointer assignments are expressed as followsand their effect is visualized by fig next : nextp next : fig insertion after pif insertion before instead of after the designated element pis desiredthe unidirectional link chain seems to cause problembecause it does not provide any kind of path to an element' predecessors howevera simple trick solves our dilemma it is illustrated in fig assume that the key of the new element is new( ) : ^ key :kp next :