How Can Linked Lists Be Used to Maintain Logical Record Order?
Linked lists can be used to keep records in logical order that are not necessarily in physical order. To create a linked list, we add a field to each data record. The link field holds the address (in our illustrations, the relative record number) of the next record in logical sequence. For example, Figure H-3 shows
the ENROLLMENT records expanded to include a linked list; this list maintains the records in StudentNumber order. Notice that the link for the numerically last student in the list is zero.
Maintain
Figure H-4 shows ENROLLMENT records with two linked lists: One list maintains the StudentNumber order and the other list maintains the ClassNumber order. Two link fields have been added to the records, one for each list.