开发者

Faster way to search for a string than the boyer moore algorithm?

Is there any faster way to开发者_运维知识库 search for a string in a file?


Look at this site, where you can also see the matching time for each of the algorithms.


The Turbo Boyer-Moore algorithm is faster, but requires more space. http://www-igm.univ-mlv.fr/~lecroq/string/node15.html


If you know anything specific about the file, there could be faster algorithms.

For example, if the file contains many repeating characters/patterns and you need to do a large number of searches, you could try using Suffix Trees: http://marknelson.us/1996/08/01/suffix-trees/

Depending on your file and the quantity of searches you need on that one file, the answer for the fastest search algorithm may change.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜