What algorithm can you use to find duplicate phrases in a string?

前端 未结 5 1159
广开言路
广开言路 2020-12-15 11:26

Given an arbitrary string, what is an efficient method of finding duplicate phrases? We can say that phrases must be longer than a certain length to be included.

Id

5条回答
  •  死守一世寂寞
    2020-12-15 12:04

    Like the earlier folks mention that suffix tree is the best tool for the job. My favorite site for suffix trees is http://www.allisons.org/ll/AlgDS/Tree/Suffix/. It enumerates all the nifty uses of suffix trees on one page and has a test js applicaton embedded to test strings and work through examples.

提交回复
热议问题