随笔分类 -  字典树

摘要:做的第一个字典树,非常直观第一类是求前缀有多少个,第二类是求前缀是否在一串字符中出现主要是字典树的构造,使用了一个嵌套的结构体,使用了指针,非常方便也非常巧妙,还有就是root,newnode必须初始空间bananabandbeeabsoluteacmbabbandabc#include <stdio.h>#include <string.h>#include <malloc.h>struct dictree{ dictree *child[26]; int n;};struct dictree *root;void insert(char *str){ s 阅读全文
posted @ 2012-04-06 15:27 shijiwomen 阅读(223) 评论(0) 推荐(0)