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