type VersNoeud= ^Noeud; Noeud= record Desc: array['a'..'z'] of VersNoeud; Complet: boolean; end; { Noeud } var Dico: VersNoeud; function Trouve(LeDico: VersNoeud; LeMot: string) : boolean; begin { Trouve } if LeDico=nil then Trouve := false else if LeMot = '' then Trouve := LeDico^.Complet else Trouve := Trouve(LeDico^.Desc[LeMot[1]], copy(LeMot,2,length(LeMot)-1)); end; { Trouve } { version non-recursive } function Trouve(LeDico: VersNoeud; LeMot: string) : boolean; var i: integer; Courant: VersNoeud; begin { Trouve } i:=1; Courant := LeDico; while (i<=Length(LeMot)) and (Courant<>nil) do begin Courant := Courant^.Desc[LeMot[i]]; i := i+1; end; { while } if Courant=nil then Trouve := false else Trouve := Courant^.Complet; end; { Trouve } procedure Imprime(LeDico: VersNoeud); procedure Print(N: VersNoeud; S: string); var i:char; Splus:string; begin if N^.Complet then writeln(S); Splus := Insert(' ',S, length(S)+1); for i := 'a' to 'z' do if N^.Desc[i]<>nil then begin Splus[length(Splus)] := i; Print(N^.Desc[i],Splus); end; { if N^.Desc[i]<>nil } end; { Print } begin { Imprime } if LeDico<>nil then Print(LeDico, ''); end; { Imprime }