by lorenzhs · 11y ago · 0 comments
For instance, finding an "ok" image from this location only requires to type "ok": https://thefiletree.com/lib/.
(Note that it has scoring optimized for paths, which the library doesn't have; slashes have special meanings in paths.)
Thus:
M[0,j] = M[i,0] = 0
M[i,j] = max(0,
M[i-1,j-1] + (needle[i] == haystack[j]),
M[i-1,j] + 1,
M[i,j-1] + 1)
Additionally, store the highest value x and its position (i,j). When you've got the full matrix, return (x,i,j). In Bioinformatics, this is known as the Smith-Waterman algorithm [2] and the result would satisfy the requirements of fuzzy substring matching.[1] https://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93P... [2] https://en.wikipedia.org/wiki/Smith%E2%80%93Waterman_algorit...