Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -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.