listelement = integer; {This has been assumed INTEGER for this file.}
{User may modify to type desired. Modify PRINT}
{and COMPARE when you do.}
listcell = record
left : listlink;
right : listlink;
element : listelement;
end;
list = listlink;
listposition = listlink;
function compare(e1,e2 : listelement):integer;
{+--- on entry - e1 and e2 are transfered in for a comparison
| on exit - compare returns +1 iff e1 > e2
| 0 iff e1 = e2
| -1 iff e1 < e2
+----------------------------------------------------------------------}
begin {compare}
if e1 > e2 then compare := 1
else if e1 < e2 then compare := -1
else compare := 0;
end; {compare}
procedure print(var out:text; e:listelement);
{+--- on entry - e is contained in the list and is ready for output
| on exit - e has been written to the corresponding out file
+------------------------------------------------------------------------}