Download Introduction to Programming in Turing First Edition
Transcript
356 Introduction to Programming in Turing be found. This is called the link or pointer to the next record. The last record in the linked list has a link which is zero (null) to indicate that there are no more records. Here is a program that allows insertions and deletions to a linked list of name and address records that is maintained in alphabetical order. It also allows you to list the file in order. The list could be used to print mailing labels. In the program there are two linked lists being maintained: one of the label records, the other of vacant record spaces in the array. The variable first points to the first record in the list of labels; the variable vacant points to the first vacant space. % The "MaintainLinkedList" program % Allows insertions and deletions to list % Permits listing in order type labelType : record name : string (20) address : string (25) link : int end record const null := 0 % Avoid using keyword label const maxLabels := 100 var labels : array 1 .. maxLabels of labelType % Initialize pointers to beginning of linked lists % The label record list is empty var first := null % Initialize links of vacant array var vacant : int := 1 % Each vacant record in array points to next for i : 1 .. maxLabels – 1 labels (i ).link := i + 1 end for % Last record in array has null link labels (maxLabels).link := null procedure insert (newLabel : labelType) % Uses global variables % Insert a new label record
Related documents
R300 User guide
Sony Ericsson R306 User Guide
Tannoy T303 Cell Phone User Manual
Sony Spiro W100i 90g Black
Deutsche Telekom Sony Ericsson Spiro W100i, TMO XTRA 2.2" 90g Green, White
DFI CM64-AL User`s manual
English - Insignia
Check-In User Manual Ver 3
A711 PRINTER SERIES REFERENCES NSKGG**** USER MANUAL
Check-In Station User Manual
TRITON 60 SERIES 60 mm MINI-KIOSK USER MANUAL
SDS Landval User Manual V710