摘要: Trie查询与插入 #include <iostream> #include <cstring> #include <algorithm> #include <vector> using namespace std; struct Trie{ int c[26];//孩子 int co;//对应字母 阅读全文
posted @ 2025-07-31 21:43 .N1nEmAn 阅读(10) 评论(0) 推荐(0)
摘要: kmp 以前觉得好难,现在感觉好简单。再次梳理一下。 首先构造next数组用来代表前缀重复最大的长度。如果prelen和i的字符相等那么直接next[i]=prelen+1,同时i和prelen递增;如果不相等,prelen是0直接加入0;如果不是0,那么取next[prelen-1]也就是避免重复 阅读全文
posted @ 2025-07-31 17:49 .N1nEmAn 阅读(8) 评论(0) 推荐(0)