【在 y*****i 的大作中提到】 : my bad. 没表述清楚。不是给定一个。是每次给一个。。就像一个真的dict一样。今天 : 你想查这个词,明天想查那个词,只不过现在我们查的是各种子串们。
p*2
17 楼
如果允许preprocess可以做到O(1)
k*j
18 楼
http://www.cs.cmu.edu/~ckingsf/bioinfo-lectures/suffixtrees.pdf PAGE 44 Determine the strings in a database {S1, S2, S3, ..., Sm} that contain query string q: Build generalized suffix tree for {S1, S2, S3, ..., Sm} Follow the path for q in the suffix tree. Suppose you end at node u: traverse the tree below u, and output i if you find a string containing #i