随笔分类 -  字典树

摘要:Problem DescriptionGiven a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the phone catalogue listed these numbers:1. Emergency 9112. Alice 97 625 9993. Bob 91 12 54 26In this case, it’s not possible to call Bob, because the centr 阅读全文

posted @ 2013-08-24 09:45 不知妖精 阅读(213) 评论(0) 推荐(0)

摘要:#include using namespace std;#include const int maxn=26;struct node { node *next[maxn]; int step;};void Create(node *T,char *str){ int len=strlen(str); for (int i=0;inext [id]==NULL) { node *p=(node *)malloc(sizeof(node)); p->step =1; for (int j=0;... 阅读全文

posted @ 2013-08-23 20:43 不知妖精 阅读(183) 评论(0) 推荐(0)

导航