7 ms·
It may be worth pointing out that the OP's appeal to the relevance to biology may not be quite so relevant. Speaking as a bioinformaticist, most of the time we
by rflrob 15y ago
It may be worth pointing out that the OP's appeal to the relevance to biology may not be quite so relevant. Speaking as a bioinformaticist, most of the time we're interested in matching strings with some number of mismatches. In that case, something like the Smith-Waterman algorithm is going to provide much more interesting results. Given the choice between matching 400 basepairs exactly; or 399 basepairs, followed by one mismatch, followed by 399 more basepairs, I'd much rather take the latter case, but the indexOf approach wouldn't be able to tell me that.
- cperciva 15y agoAlso, indels. Mismatches are the easy part -- in my thesis I show how, with linear-time preprocessing, you can solve the overlap problem with a constant proportion of mismatches in O(sqrt(overlap length)) time.