.

150, 젠 120, .. 120, .

P -

Q -

V - , .

 

150, ( ).

 

 

:

 

 

Q=nil Q=nil

P=Tree P=Tree

While (P<>nil) do While (P<>nil) do

Q=P Begin

If key=k(P) then Q=P;

search=P If key=P^.k then

return Begin

EndIf search:=P;

If key<k(P) then exit;

P=left(P) End;

else If key<P^.k then

P=right(P) P:=P^.left;

EndIf else

EndWhile P:=P^.right;

V=maketree(key,rec) End;

If key<k(Q) then V=maketree(key,rec)

else If key<Q^.k then

Right(Q)=V Q^.left:=V

EndIf else

search=V Q^.right:=V;

Return search:=V

 




- -  - -  - -