- 2


d: rec; { }

p: plist { }

end;

var p0: plist; { }

, plist

list, , , . - .

, , , ( ) . :

  • ;
  • ;
  • .

: {function order (r1,r2: rec): integer;} -1, 0 +1 , , r1 r2

( ). r r d . p0^ , order(r,d)=0 ( ), order(r,d)=1 ( ), Nil ( ).

function find_in_list (r: rec): plist; { , Nil - }

var next: plist;

begin

find_in_list := Nil;

next := po; { }

while (next<>Nil) and (order (r, next^.d) >= 0) do

{C }

if order (r, next^.d) = 0

then begin find_in_list := next; break end { }

else next := next.p; { ; }

end;

, , ( ).


- -  - -  - -