Which is the fastest pattern matching algorithm
-
Hi! I'm looking for a way to find the position of a certain pattern within a string. On my search on the internet I've come accross various algorithms such as Knuth-Morris-Pratt and Boyer-Moore (just to name two). But which is the fastest?
IIRC, BM is optimal for long input string + long search string. A common place to apply this is in a text editor's Find function. BM is realy simple to implement, and works well for most cases. xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
-
IIRC, BM is optimal for long input string + long search string. A common place to apply this is in a text editor's Find function. BM is realy simple to implement, and works well for most cases. xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots