suffix tree
import SuffixTree from '@yiminghe/suffix-tree';
const tree = new SuffixTree("abceabc$");
console.log(tree.getLongestDupSubstr()); // => abc
- constructor(s:string)
construct a suffix tree using string s
- getLongestDupSubstr():string
Return any duplicated substring that has the longest possible length.
- root: SuffixTree
root node of suffix tree
- next:
Map<string, SuffixTreeNode>
map of next char to next SuffixTreeNode
- start: number
start position of string
- getEdgeLength(): number
edge string length
- getEnd(): number
end position of string