随笔分类 -  数据结构-字典树

摘要:题目描述: 给定一个单词列表,我们将这个列表编码成一个索引字符串 S 与一个索引列表 A。例如,如果这个列表是 ["time", "me", "bell"],我们就可以将其表示为 S = "time#bell#" 和 indexes = [0, 2, 5]。 对于每一个索引,我们可以通过从字符串 S 阅读全文
posted @ 2020-03-31 12:12 猪突猛进!!! 阅读(423) 评论(0) 推荐(0)
摘要:mark: 题目有字串匹配的过程 有两点 1.为了高效的匹配子串 可以把所有的子串都预处理进去 然后字典树计数就放在最后面 2.在同一个母串处理自串的时候 会有重复的时候 比如abab 这里去重用个标记位就可以了(一开始用map 结果超时了,,, 果然还是想太简单了) 上代码 阅读全文
posted @ 2016-10-19 20:01 猪突猛进!!! 阅读(127) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<iostream> #include<string> #include<cstdlib> #define maxn 2 #include<queue> using namespace std; struct Tri { Tri*next[maxn] 阅读全文
posted @ 2016-10-18 16:18 猪突猛进!!! 阅读(122) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<iostream> #include<string> #include<cstdlib> #define maxn 10 using namespace std; struct Tri { Tri*next[maxn]; int num; }; T 阅读全文
posted @ 2016-10-18 16:01 猪突猛进!!! 阅读(144) 评论(0) 推荐(0)
摘要:待整理 阅读全文
posted @ 2016-08-18 15:55 猪突猛进!!! 阅读(122) 评论(0) 推荐(0)