trie树(字典树)(二)

2014-11-24 01:07:48 · 作者: · 浏览: 4
rminal=true; } void Delete(Trie *pnt)// delete the whole tree { if(pnt!=NULL) { for(int i=0;ison[i]!=NULL)Delete(pnt->son[i]); delete pnt; pnt=NULL; } } Trie* Find(Trie *pnt,char *s,int len)//trie to find the current word { Trie *temp=pnt; for(int i=0;i
son[s[i]-base]!=NULL)temp=temp->son[s[i]-base]; else return NULL; return temp; }