program nikos(input,output); uses crt; type pp=^rec; rec=record k1,k2,k3:integer; n,p:pp; end; var h,t,aux,temp:pp; c:char; procedure insert(var x,y:pp); var temp:pp; begin new(temp); write(' NEW RECORD: key1,key2,key3 ='); readln(temp^.k1,temp^.k2,temp^.k3); if (x=nil) then begin x:=temp; y:=temp; x^.p:=nil; y^.n:=nil; end; if (x<>nil) then begin if temp^.k1y^.k1 then begin temp^.p:=y; y^.n:=temp; y:=temp; end; if (temp^.k1>x^.k1) and (temp^.k1nil) then begin writeln('Insert key1 that you want to delete :'); readln(temp^.k1); if(x=y) and (temp^.k1=x^.k1) then begin; x:=nil; y:=nil; end; if(x<>y) and (temp^.k1=x^.k1) then begin temp:=x; x:=x^.n; dispose(temp); end; if (x<>y) and (temp^.k1=y^.k1) then begin; temp:=y; y^.p^.n:=nil; y:=y^.p; dispose(temp); end; if (temp^.k1>x^.k1) and (temp^.k1temp^.k1) do aux:=aux^.n; writeln(aux^.k1); aux^.n^.p:=aux^.p; aux^.p^.n:=aux^.n; dispose(aux); end; end; end; procedure print(x,y:pp); var aux:pp; begin aux:=x; if x=nil then writeln('EMPTY'); if aux<>nil then begin while (aux<>y) do begin writeln('key1:',aux^.k1,' key2:',aux^.k2,' key3:',aux^.k3); aux:=aux^.n end; writeln('key1:',aux^.k1,' key2:',aux^.k2,' key3:',aux^.k3); end; end; begin clrscr; h:=nil; if(h=nil) then writeln('to h einai keno'); t:=nil; c:='g'; if t=nil then writeln('to t einai keno'); while(c<>'q') do begin writeln('insert elete

rint uit'); readln(c); if c='i' then insert(h,t); if c='p' then print(h,t); if c='d' then delete(h,t); end; end.