views:

214

answers:

2

Which algorithm would you use to search short substrings in short texts? By short I mean 5-10 characters for substring and 255 for the string. I'm thinking about choosing algorithm depending on input data length. Which algorithm is better for longer inputs?

+5  A: 

Try Turbo-BM. However, IMO, with such short strings usual linear scan will suffice.

Anton Gogolev
A: 

You can try Suffix Trees or Suffix Arrays. Both depend on the pattern length.

Yuval F