开发者

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

开发者 https://www.devze.com 2023-03-18 20:40 出处:网络
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 fast

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

精彩评论

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