摘要:
字典树,处理数据较麻烦。CODE:#include<iostream>#include<ctype.h>#include<stdio.h>#include<stdlib.h>usingnamespacestd;structTrie{Trie*next[26];charsave[12];intvalue;Trie(){for(inti=0;i<26;i++)next[i]=0;value=0;}};voidinsert(Trie*&root,char*sz1,char*sz2){inti=0,branch=0;Trie*p=root; 阅读全文
posted @ 2012-09-11 21:47
有间博客
阅读(246)
评论(0)
推荐(0)
摘要:
字典树模板题。CODE:字典树#include<iostream>usingnamespacestd;structTrie{Trie*next[26];intcount,value;Trie(){for(inti=0;i<26;i++)next[i]=0;value=0;count=1;}};voidinsert(Trie*&root,char*s){inti=0,branch=0;Trie*p=root;if(!p){p=newTrie();root=p;}while(s[i]){branch=s[i]-'a';if(p->next[branc 阅读全文
posted @ 2012-09-11 20:09
有间博客
阅读(192)
评论(0)
推荐(0)
浙公网安备 33010602011771号