BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:
I'm looking for algorithms and/or implementations for comparing two strings and determining if they are the same barring a single transposition of two adjacent characters.
comp( 'foo', 'ofo' ); # True comp( 'foo', 'foo' ); # False comp( 'abcde', 'bacde' ); # True comp( 'abcde', 'cabde' ); # False
If the method reports the position of the transposition as well as yes/no to the first question thats a bonus.
Efficiency is paramount.
Thanks
Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.
Back to
Seekers of Perl Wisdom