【发布时间】:2016-11-15 14:58:01
【问题描述】:
寻找最长重复子串的算法公式如下
1)build the suffix tree
2)find the deepest internal node with at least k leaf children
但我不明白为什么这是有效的,所以基本上是什么让这个算法正确?另外,我发现这个算法的来源说是找到重复的O(n) 中的子串,其中 n 是子串的长度,这对我来说也不清楚!让我们考虑下面的树,这里最长的重复子串是“ru”,如果我们应用 DFS,它将在 5 中找到它步但不在 2
你能给我解释一下这些东西吗?
谢谢
【问题讨论】:
-
它不能在子串的长度上是线性的,因为后缀树结构在字符串本身的长度上是线性的
标签: string algorithm suffix-tree suffix-array longest-substring