随笔分类 - 字典树
摘要:做的第一个字典树,非常直观第一类是求前缀有多少个,第二类是求前缀是否在一串字符中出现主要是字典树的构造,使用了一个嵌套的结构体,使用了指针,非常方便也非常巧妙,还有就是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
阅读全文

浙公网安备 33010602011771号