|There's more than one way to do things|
Detecting transpositionsby BrowserUk (Pope)
|on Aug 06, 2003 at 06:17 UTC||Need Help??|
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.
If the method reports the position of the transposition as well as yes/no to the first question thats a bonus.
Efficiency is paramount.
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.