Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function TTrie.AddIter( wrd: string): boolean;
- var tmp:Tnode;
- i:integer;
- begin
- Result:=CheckWrd(wrd);
- if Result then
- begin
- if FRoot=nil then
- FRoot:=TNode.Create;
- tmp:=FRoot;
- for i:=1 to length(wrd) do
- begin
- if (tmp.Next[wrd[i]]=nil) then
- tmp.Next[wrd[i]]:=TNode.Create;
- tmp:=tmp.Next[wrd[i]];
- end;
- if (tmp.Point) then
- result:=false
- else
- tmp.Point:=true;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement