Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -0,0 +1,26 @@
|
|||
MODULE SinglyLinkedList EXPORTS Main;
|
||||
|
||||
TYPE
|
||||
Link = REF LinkRcd;
|
||||
LinkRcd = RECORD
|
||||
Next: Link;
|
||||
Data: INTEGER
|
||||
END;
|
||||
|
||||
PROCEDURE InsertAppend(anchor, next: Link) =
|
||||
BEGIN
|
||||
IF anchor # NIL AND next # NIL THEN
|
||||
next.Next := anchor.Next;
|
||||
anchor.Next := next
|
||||
END
|
||||
END InsertAppend;
|
||||
|
||||
VAR
|
||||
a: Link := NEW(Link, Next := NIL, Data := 1);
|
||||
b: Link := NEW(Link, Next := NIL, Data := 2);
|
||||
c: Link := NEW(Link, Next := NIL, Data := 3);
|
||||
|
||||
BEGIN
|
||||
InsertAppend(a, b);
|
||||
InsertAppend(a, c)
|
||||
END SinglyLinkedList.
|
||||
Loading…
Add table
Add a link
Reference in a new issue